使用WinSCP到SFTP时,“未配置预期的主机密钥,请使用-hostkey开关”

时间:2018-08-22 00:48:14

标签: ssh sftp winscp

我需要将.csv文件上传到SFTP。我有一个.ppk文件

我的WinSCP脚本:

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

错误:

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

日志文件还包含:

文件错误:

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

有人可以建议

谢谢

1 个答案:

答案 0 :(得分:0)

由于错误消息提示您,您的open命令丢失了-hostkey switch

请参阅:


最简单的解决方案是拥有WinSCP GUI generate a script template for you


顺便说一句,您的问题与.ppk /私钥无关。参见Understanding SSH key pairs