When using WinSCP.exe and I set the path to my private key file I am able to authenticate to the remote site. However when I use WinSCP.com and pass the same key file path by using the -privatekey switch of the open script command I get the error "Server refused our key." I need to get the WinSCP.com to behave like WinSCP.exe.
The path I am testing with is c:\key.ppk.
Here is the script:
WinScp script # Automatically answer all prompts negatively not to stall # the script on errors option batch abort # Disable overwrite confirmations that conflict with the previous option confirm off # #Dynamic code is added below # open -passive -timeout=6 SFTP://email@example.com -privatekey=c:\key.ppk -hostkey="ssh-rsa 2048 4f:cd:a3:33:4b:63:38:48:7a:c4:4e:25:28:3d:a2:f3" PUT -resume c:\test.asc test.asc close exit
Here is the output:
c:\winscp.com /script=st.concursolutions.com.17294.txt batch abort confirm off Searching for host... Connecting to host... Authenticating... Using username "userid". Server refused our key. Using keyboard-interactive authentication. Password: Connection has been unexpectedly closed. Server sent command exit status 0. Authentication log (see session log for details): Using username "userid". Server refused our key. Authentication failed.