2019-03-19

WinSCP configure hostkey in winscp script


What's WinSCP hostkey


Before OpenSSH 6.8
 ssh-keygen -lf <(ssh-keyscan localhost 2>/dev/null)



Since OpenSSH 6.8, you have to add the -E md5 switch to get the format needed for WinSCP.

ssh-keygen -E md5 -lf <(ssh-keyscan localhost 2>/dev/null)


[billson@169 ~]$ ssh-keygen -E md5 -lf <(ssh-keyscan localhost 2>/dev/null)
2048 MD5:aa:bb:cc:xx:xx:xx:xx:43:79:ae:90:ca:83:d3:xx:ef localhost (RSA)
256 MD5:xx:81:xx:7a:xx:49:68:87:xx:a3:54:xx:61:b3:xx:15 localhost (ECDSA)
256 MD5:xx:69:29:4a:xx:f0:8f:74:xx:5d:1b:86:aa:xx:d7:1b localhost (ED25519)



USING (RSA)
GET CONTENT BETTWEN [MD5:]*********************[localhost (RSA)] without space
SUPPOSE also using 2048


Replace
open sftp://user:password@example.com/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."
to:
open sftp://user:password@example.com/ -hostkey="ssh-rsa 2048 aa:bb:cc:xx:xx:xx:xx:43:79:ae:90:ca:83:d3:xx:ef"




No comments:

Google Referrals