How to correctly connect to ftp using password and username

Advertisement

PovilasPanavas
Joined:
Posts:
4
Location:
Lithuania

How to correctly connect to ftp using password and username

I can't figure out it on my own. I'm using example from FAQ. The problematic line is marked.

# 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? :)

Reply with quote

Advertisement

PovilasPanavas
Joined:
Posts:
4
Location:
Lithuania

I have tried storing session

After searching for solution, I've tried creating session.ini file and storing password and username.

[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."

Reply with quote

PovilasPanavas
Joined:
Posts:
4
Location:
Lithuania

I've found one way to fix it

I created session throughout graphical interface. And using it in script. It works fine! :roll: :wink:

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: How to correctly connect to ftp using password and username

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: I've found one way to fix it

PovilasPanavas wrote:

I created session throughout graphical interface. And using it in script. It works fine! :roll: :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

Reply with quote

PovilasPanavas
Joined:
Posts:
4
Location:
Lithuania

Re: How to correctly connect to ftp using password and username

martin wrote:


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

oh! :) Thank you.

Reply with quote

geri777
Guest

Re: I've found one way to fix it

Seems not to work if the password contains a forward-slash. Example: ftp://myuser:abcdefg/123@mydomain.com/

Reply with quote

Advertisement

You can post new topics in this forum