WinSCP command line: Hostkey not found in cache error

I am trying to connect to a Unix server from the WinSCP command line for the first time.

It closes with the following error:

The server host key was not found in the cache. You have no guarantee that the server is the computer you think it is.

Server key fingerprint rsa2: ssh-rsa 1024 42: 9e: c7: f4: 7f: 8b: 50: 10: 6a: 06: 04: b1: d4: f2: 04: 6d If you trust this host, click Yes . To connect without adding the host key to cac it, click No. To refuse the connection , click Cancel .

On the WinSCP command line, it does not ask for input (Yes or No). It failed with an authentication error. If I connect via the WinSCP tool, I get the same error. However, I can press YES.

I also know that if I add a -hostkey

switch on the command line, I can connect. But I dont want to pass hostkey in my batch script as I will be connecting to different servers. So my requirement is to pass "YES" from the command line in case of this error. Can anyone help?

+3


source to share


1 answer


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

Skipping fingerprint verification means you have lost any security and there is no point in using SSH / SFTP anymore.

Anyway, if you don't need security, you can use -hostkey=*

switch
to unconditionally accept any host key.



Other links:

+1


source







All Articles