Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Hostkey not found in cache

Quoting my answer on your duplicate post on stackverflow.com

https://stackoverflow.com/q/25591844/850848#25594082

Host key fingerprint verification is a crucial step in securing your SSH connection. Even if you are using set of sessions with your script, it does not excuse you. The fingerprint should be part of set of information you have for each of the sessions (in addition to hostname, username and password).

Skipping fingerprint verification means that you loose any security and there's no point using SSH/SFTP anymore.

See https://winscp.net/eng/docs/ssh_verifying_the_host_key

Anyway, if you do not care about security, you can use -hostkey=* switch to unconditionally accept any host key.
See https://winscp.net/eng/docs/scriptcommand_open
ebavkar

Hostkey not found in cache

I am trying to connect to unix server from winscp commandline for the first time. It closes with the the following error:

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.

The server's rsa2 key fingerprint is: ssh-rsa 1024 42:9e:c7:f4:7f:8b:50:10:6a:06:04:b1:d4:f2:04:6d If you trust this host, press Yes. To connect without adding host key to the cac he, press No. To abandon the connection press Cancel.

In the winscp commandline,it does not ask for any input(Yes or No). It closes with Authentication failed. If I connect through the winscp tool, I'll get the same error. However, I'll be able to press YES.

I also know that If I add hostkey switch in the command line, I'll be able to connect. But, I don't want pass hostkey in my batch script as I will be connecting to various servers. So, my requirement is to pass "YES" input from the commandline in case of this error. Can someone help?