MSM
MSM

Reputation: 357

"Expected host key was not configured, use -hostkey switch" when using WinSCP to SFTP

I have requirement of uploading the .csv file to SFTP. I have got a .ppk file

My WinSCP script:

open sftp://[email protected]/ -privatekey=ssh.ppk
lcd Z:\TR TEM DATA\
cd /home/cli/mm/gns
ascii
put -transfer=ascii -latest *.csv
exit

Error:

Searching for host...
Connecting to host...
Authenticating...
Expected host key was not configured, use -hostkey switch

The log file also contains:

Error in the file :

Server also has ssh-dss host key, but we don't know it

Can someone please advise

Thank you

Upvotes: 2

Views: 3259

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202494

Your open command is missing -hostkey switch, as the error message hints you.

See:


The easiest solution is to have WinSCP GUI generate a script template for you.


Btw, you problem has nothing to do with .ppk/private key. See Understanding SSH key pairs.

Upvotes: 1

Related Questions