Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: can I see how you specified the port?

wanj4 wrote:

I am looking for a port specification example of winscp command prompt

sftp://username@example.com:port
See https://winscp.net/eng/docs/session_url
wanj4

can I see how you specified the port?

I am looking for a port specification example of winscp command prompt
martin

Re: scripting syntax to connect to FTP when password fails

rixter77 wrote:

I found the problem: it was the ; in the password. Eliminating that allowed the password to work....

You have to URL-encode the semicolon:
https://winscp.net/eng/docs/session_url
rixter77

Re: scripting syntax to connect to FTP when password fails

I found the problem: it was the ; in the password. Eliminating that allowed the password to work....

rixter77 wrote:

The previous thread about "scripting syntax to connect to FTP" almost answered my question. I was glad to learn the tip about putting /loglevel=* to see if there is a password failure.

That is what is happening in my case; here is the log file:
2015-04-20 19:28:38.745 Connected with tourism-engine.com. Waiting for welcome message...
< 2015-04-20 19:28:38.776 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
< 2015-04-20 19:28:38.776 220-You are user number 1 of 50 allowed.
< 2015-04-20 19:28:38.776 220-Local time is now 01:28. Server port: 21.
< 2015-04-20 19:28:38.776 220-IPv6 connections are also welcome on this server.
< 2015-04-20 19:28:38.776 220 You will be disconnected after 15 minutes of inactivity.
> 2015-04-20 19:28:38.776 USER automat@tourism-engine.com
< 2015-04-20 19:28:38.806 331 User automat@tourism-engine.com OK. Password required
> 2015-04-20 19:28:38.807 PASS bC3-fpK
< 2015-04-20 19:28:42.175 530 Login authentication failed

However, the above log does *not* show the complete password. I am not going to reveal the complete password here, of course, but the next character in the password is a semi-colon, or ; character.
This password works in the WinSCP GUI login; but the fact that the log stops on that character makes me suspect the problem is the semi-colon in the password, and how it is getting fed to login.
I do not see any documentation saying this character should not be used in a password.
Can anyone help me verify if this is the case?

thanks,
rixter
rixter77

scripting syntax to connect to FTP when password fails

The previous thread about "scripting syntax to connect to FTP" almost answered my question. I was glad to learn the tip about putting /loglevel=* to see if there is a password failure.

That is what is happening in my case; here is the log file:
2015-04-20 19:28:38.745 Connected with tourism-engine.com. Waiting for welcome message...
< 2015-04-20 19:28:38.776 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
< 2015-04-20 19:28:38.776 220-You are user number 1 of 50 allowed.
< 2015-04-20 19:28:38.776 220-Local time is now 01:28. Server port: 21.
< 2015-04-20 19:28:38.776 220-IPv6 connections are also welcome on this server.
< 2015-04-20 19:28:38.776 220 You will be disconnected after 15 minutes of inactivity.
> 2015-04-20 19:28:38.776 USER automat@tourism-engine.com
< 2015-04-20 19:28:38.806 331 User automat@tourism-engine.com OK. Password required
> 2015-04-20 19:28:38.807 PASS bC3-fpK
< 2015-04-20 19:28:42.175 530 Login authentication failed

However, the above log does *not* show the complete password. I am not going to reveal the complete password here, of course, but the next character in the password is a semi-colon, or ; character.
This password works in the WinSCP GUI login; but the fact that the log stops on that character makes me suspect the problem is the semi-colon in the password, and how it is getting fed to login.
I do not see any documentation saying this character should not be used in a password.
Can anyone help me verify if this is the case?

thanks,
rixter
martin

So the connection string contains both sftp & ftp.

It does not really. The ftp.ohiohealthgroup.com is just a hostname, it does not specify a protocol.
Guest

martin wrote:

In the GUI you connect to ftp.ohiohealthgroup.com, what resolves to 192.168.30.242, while in the latest log you connect to ohiohealthgroup.com, what resolves to 64.87.23.209.


It's working! Thank you for your help. For anyone else reading this, here is a summary. I tried both of these connection strings in a batch file, and they failed:

open sftp://*******:********@ohiohealthgroup.com
open ftp://*******:********@ohiohealthgroup.com

The correct connection string is:
open sftp://*******:********@ftp.ohiohealthgroup.com

So the connection string contains both sftp & ftp.
martin

In the GUI you connect to ftp.ohiohealthgroup.com, what resolves to 192.168.30.242, while in the latest log you connect to ohiohealthgroup.com, what resolves to 64.87.23.209.
Sector7G

martin wrote:

You are using an SFTP protocol in the interactive session (you do not specify a protocol in an open command and WinSCP defaults to SFTP). While you use an FTP protocol in the failed session (you specify ftp:// explicitly).


I have tried both FTP and SFTP in the batch file. When I use SFTP and run the script, the window returns the error: The server rejected SFTP connection, but it listens for FTP connections. Did you want to use FTP protocol instead of FTP? Prefer using encryption.

Thank you for your comments. I hope I can get this working.
martin

You are using an SFTP protocol in the interactive session (you do not specify a protocol in an open command and WinSCP defaults to SFTP). While you use an FTP protocol in the failed session (you specify ftp:// explicitly).
Sector7G

My apologies... I must have pulled the wrong file. The file I attached is from a successful session today.
martin

I mean from a log, where you "follow the prompts in the command window to enter the FTP server, user name, and password, it works."

The log you have attached shows a failed session.
Sector7G

martin wrote:

Can you attach a log of a successful interactive session?

Do you mean a log from a manual session? (where I enter parameters one at a time instead of using a script). I created a log from a successful manual session.
thank you
martin

Can you attach a log of a successful interactive session?
Sector7G

martin wrote:

Try to add /loglevel=* to command-line. It makes the log record the actual password. Check that the password is correct.


I added the log level, then tried running my batch file again. It still failed saying "login or password incorrect". I looked at the log file (several times). I am sure that the user/pw are correct. If I open a command line, and enter the values one line at a time (open site, enter user name, enter pw) then it works. There are no special characters in the user/pw. I have attached the most recent log file. I did replace the user/pw with stars in the log.

thank you
martin

Try to add /loglevel=* to command-line. It makes the log record the actual password. Check that the password is correct.
Guest

Sector7G wrote:

Thank you for your reply. I was able to generate the log file, and I have attached a copy for you. The end of the log says "530 Login or Password incorrect". But this is the same user/password that I enter when I run the commands manually. It works there, just not in the batch file.


I forgot to mention, there are no special characters in the user name or password.
Sector7G

Thank you for your reply. I was able to generate the log file, and I have attached a copy for you. The end of the log says "530 Login or Password incorrect". But this is the same user/password that I enter when I run the commands manually. It works there, just not in the batch file.
martin

Re: scripting syntax to connect to FTP

Your syntax is correct.
Are there any special characters in your username or password?

Please attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
Sector7G

scripting syntax to connect to FTP

I'm a newbie at WinSCP. I have been reading the help files and Google, but I'm missing something. I think I have the syntax wrong in my batch file. When I follow the prompts in the command window to enter the FTP server, user name, and password, it works. But when I put it all into a batch file, I get an error:
access denied
authentication failed


This is what I have in my batch file (with a different user/pw, of course). While reading over the command line instructions, I did not see an example that had a user id and password for FTP. There are examples for FTPS and SFTP. Is there a different syntax for FTP?
option batch abort

option confirm off
open ftp://username:password@ftpserver.com