Ahoj Martine,
Apologies for re-opening this post but I feel it's relevant.
I followed your FAQ at
https://winscp.net/eng/docs/faq_hostkey#automation and generated the hostkey on the Ubuntu box using: ssh-k3ygen -l -f /home/user/wftpserver/myftp_ssh.key -E MD5 to get desired output and use that output in the format within the script as follows:
"C:\WinSCP\WinSCP.exe" /log=c:\WinSCP\logs\winscp.log /command "open sftp://user:wouldyouliketoknow@mydomain.com" -hostkey="ssh-rsa 2048 MD5:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" "put "C:\Test\file.xlsx" /Data/File_%%TIMESTAMP#yyyymmddhhnnss%%.xlsx" "exit"
I even tried to copy the key from saved session I manually accepted within the WinSCP GUI and paste it in my .cmd script but it still doesn't work.
Basically, the issue is that I cannot connect automatically using the script to SSFTP (SSH 2.0) WingFTP server. I need to automate the acceptance of the hostkey as I need to deploy this to 12 other windows based machines.
From the .log I get this:
". 2017-06-15 16:28:51.290 Verifying host key ecdsa-sha2-nistp256 nistp256,0x0000000000000000 0000000000000000 000000000000000 000000000000000 ,0x0000000000000000 000000000000000 00000000000000 0000000000000000 with fingerprint ecdsa-sha2-nistp256 256 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
. 2017-06-15 16:28:51.290 Asking user:
. 2017-06-15 16:28:51.290 **Continue connecting to an unknown server and add its host key to a cache?**
. 2017-06-15 16:28:51.290
. 2017-06-15 16:28:51.290 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.
. 2017-06-15 16:28:51.290
. 2017-06-15 16:28:51.290 The server's ecdsa-sha2-nistp256 key fingerprint is:
. 2017-06-15 16:28:51.290 ecdsa-sha2-nistp256 256 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
. 2017-06-15 16:28:51.290
. 2017-06-15 16:28:51.290 If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel.
. 2017-06-15 16:28:51.290 In scripting, you should use a -hostkey switch to configure the expected host key. ()
. 2017-06-15 16:29:01.294 Attempt to close connection due to fatal exception:
* 2017-06-15 16:29:01.294 Host key fingerprint is ecdsa-sha2-nistp256 256 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00.
* 2017-06-15 16:29:01.294 (Exception) **Host key wasn't verified!**
. 2017-06-15 16:29:01.294 Closing connection.
. 2017-06-15 16:29:01.294 Sending special code: 12"