1

I am using WinSCP to copy files to a server.

We are using it with the GUI.

I now want to automate this step and use WinSCP from the commandline.

Unfortunately we are "Unable to authenticate".

Here is the relevant log fragment from being able to authenticate with the GUI:

! 2017-03-04 00:23:05.959 Using username "goofy".
. 2017-03-04 00:23:06.115 Server offered these authentication methods: publickey,password,keyboard-interactive
. 2017-03-04 00:23:06.115 Attempting keyboard-interactive authentication
. 2017-03-04 00:23:06.162 Prompt (keyboard interactive, "SSH server authentication", "Using keyboard-interactive authentication.", "Password: ")
. 2017-03-04 00:23:06.162 Using stored password.
. 2017-03-04 00:23:06.333 Prompt (keyboard interactive, "SSH server authentication", <no instructions>, <no prompt>)
. 2017-03-04 00:23:06.333 Ignoring empty SSH server authentication request
. 2017-03-04 00:23:06.380 Access granted

Here is the relevant log fragment from being rejected by the commandline:

! 2017-03-04 00:10:33.353 Using username "goofy".
. 2017-03-04 00:10:33.400 Server offered these authentication methods: publickey,password,keyboard-interactive
. 2017-03-04 00:10:33.400 Attempting keyboard-interactive authentication
. 2017-03-04 00:10:33.431 Prompt (keyboard interactive, "SSH server authentication", "Using keyboard-interactive authentication.", "Password: ")
. 2017-03-04 00:10:33.431 Using stored password.
. 2017-03-04 00:10:33.587 Keyboard-interactive authentication failed
! 2017-03-04 00:10:33.587 Access denied
. 2017-03-04 00:10:33.587 Server offered these authentication methods: publickey,password,keyboard-interactive
. 2017-03-04 00:10:33.587 Attempting keyboard-interactive authentication
. 2017-03-04 00:10:33.665 Prompt (keyboard interactive, "SSH server authentication", "Using keyboard-interactive authentication.", "Password: ")
. 2017-03-04 00:10:33.665 Disconnected: Unable to authenticate

Here is the commandline we are using:

"%winscp%" /ini=nul ^
           /log=C:\TEMP\winscplog.txt ^
           /command "open sftp://goofy:[email protected]/ -hostkey=""ssh-rsa 2048 d4:1c:1a:4c:c3:60:d5:05:12:02:xx:xx:xx:xx:xx:xx""" ^
           "put ""%outfile%"" /home/public/uploadarea/%basename%" ^
           "exit"

Note: it is not good practice to put your password on the commandline so please do not take this as best practice if you are using this as an example.

1 Answer 1

1

See Why I cannot connect/transfer using script, when I can using GUI?


Extracting the parts, that can be relevant for you specifically:

Enable password logging and make sure the same password is used in GUI and scripting.

In GUI, you can enable password logging in preferences. In scripting, you can use the /loglevel=* command-line switch.


You can also have GUI generate a script template for you.


If this does not help, we need to see a complete session log file for both GUI and the script.

1
  • It was a bad password caused by my sleep depravation stupor. Generating the script and comparing my commandline this morning made it painfully clear that I should have just gone to bed. Mar 4, 2017 at 15:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .