However I need to automate a few file transfers so I have to use WinSCP from command line (MSDOS style).
The structure of my command file is the following:
WinSCP.exe /log=ftpcmd.log /command "option confirm off" "option batch continue" ^
"open sftp://<user>:<passw> @ftp.<hostname>
-hostkey="ssh-rsa 2048 b7:d7:c0:65:a8:5e:a1:ef:11:91:db:98:3d:92:2a:2a"" ^
"put d:\timbrature\ 20140516.csv /home/timbr/timbrature/" ^
In this example I put <user> <passw> and <hostname> in place of the real username, password and host names.
The auto-confirmation fails with the following messages:
“Host key does not match configured key ssh-rsa”.
**Continue connecting to an unknown server and add its host key to a cache?**
The server's host key was not found in the cache. You have no guarantee that the server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 b7:d7:c0:65:a8:5e:a1:ef:11:91:db:98:3d:92:2a:2a
If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel. ()
Attempt to close connection due to fatal exception:
Host key fingerprint is ssh-rsa 2048 b7:d7:c0:65:a8:5e:a1:ef:11:91:db:98:3d:92:2a:2a.
(Exception) Host key wasn't verified!
Sending special code: 12
I double checked the host key in the server boot data and it is correct and matches with the one which appears in the above log file.
For debugging purpose I tried to use -hostkey="*” and it works. I can't understand what is wrong with the auto-confirmation.
Can someone help?