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.