sshsftppublic-keywinscpfingerprinting

"Host key does not match configured key" when uploading file to SFTP using WinSCP command


I'm using SSIS to upload files to SFTP. I'm using command prompt to execute the WinSCP command. Code is as below:

winscp.com /command  "open sftp://username@sftp.client.com/ -privatekey="H:\Share\CT_SFTPPrivateKey\privatekey.ppk" -hostkey=""ssh-ed25519 256 71yCy6d6qLSxxX5dZ/+99On+8xiDnJ4NG7tXmKiOMik=."""  "put -delete  H:\Share\WorkingFolders\BOPIS\*.csv /sc/production/incoming/segment/" /log="H:\Share\WorkingFolders\BOPIS\WinSCP.log" "exit"

I'm getting Host key does not match configured key exception.


Solution

  • The . at the end of your host fingerprint should not be there.

    -hostkey=""ssh-ed25519 256 71yCy6d6qLSxxX5dZ/+99On+8xiDnJ4NG7tXmKiOMik=""
    

    WinSCP GUI can generate a complete valid command-line template for you.