Topic "How to correctly connect to ftp using password and username"

Author Message
PovilasPanavas
[View user's profile]

Joined: 2009-12-24
Posts: 4
Location: Lithuania
I can't figure out it on my own. I'm using example from FAQ. The problematic line is marked.

Quote:

# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
# PROBLEM IS BELOW
open username:password@aaaa.bbbbb.lt
# Change remote directory
cd dainava
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
put Groups.txt
# Disconnect
close


It shows: "Searching for host... Network error: Connection timed out."

If i change "open ftp://aaaa.bbbb.lt" then it works, but prompts for username and password.

Also, if i try "open aaaa.bbbb.lt" shows "Searching for host... Network error: Connection timed out." (the same error as above)

How to fix script? Smile
Advertisements
PovilasPanavas
[View user's profile]

Joined: 2009-12-24
Posts: 4
Location: Lithuania
After searching for solution, I've tried creating session.ini file and storing password and username.

Quote:
[Sessions\mysession]
HostName=aaaa.bbbbb.lt also tried ftp://aaaa.bbbbb.lt
UserName=myuser
PassWord=mypassword


And executing it
C:\Program Files\WinSCP>WinSCP.com /script=upload.script /ini=session.ini

Now, the error've changed: "Searching for host... Host does not exist."
PovilasPanavas
[View user's profile]

Joined: 2009-12-24
Posts: 4
Location: Lithuania
I created session throughout graphical interface. And using it in script. It works fine! Rolling Eyes Wink

Where would I find session files? I want to use it directly with /ini=mysession.ini
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
PovilasPanavas wrote:
It shows: "Searching for host... Network error: Connection timed out."

If i change "open ftp://aaaa.bbbb.lt" then it works, but prompts for username and password.

Also, if i try "open aaaa.bbbb.lt" shows "Searching for host... Network error: Connection timed out." (the same error as above)

Should be:
open ftp://username:password@hostname
_________________
Martin Prikryl
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
PovilasPanavas wrote:
I created session throughout graphical interface. And using it in script. It works fine! Rolling Eyes Wink

Where would I find session files? I want to use it directly with /ini=mysession.ini

Make sure you configure WinSCP to store its settings to INI file.
_________________
Martin Prikryl
PovilasPanavas
[View user's profile]

Joined: 2009-12-24
Posts: 4
Location: Lithuania
prikryl wrote:

Should be:
open ftp://username:password@hostname


oh! Smile Thank you.
geri777

Guest


Seems not to work if the password contains a forward-slash. Example: ftp://myuser:abcdefg/123@mydomain.com/
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24995
Location: Prague, Czechia
geri777 wrote:
Seems not to work if the password contains a forward-slash. Example: ftp://myuser:abcdefg/123@mydomain.com/

You have to URL-encode it:
https://winscp.net/eng/docs/session_url
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License