1
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:changeme@10.20.10.225/ -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.
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. – Michael Potter – 2017-03-04T15:52:47.897