known_hosts file for WinSCP?

3

1

Is there a way in WinSCP to configure a known_hosts file with key fingerprints so as to not be queried by WinSCP when you want to connect?

Mr. Roland

Posted 2017-06-01T09:58:37.590

Reputation: 143

1Do you mean you want to use an existing known_hosts with WinSCP? Or are just asking, where does WinSCP store the known host keys? – Martin Prikryl – 2017-06-01T10:46:24.127

@MartinPrikryl I want to be able to configure WinSCP so that I don't get the dialog asking to store the fingerprint when I connect the first time. I have the host key. – Mr. Roland – 2017-06-01T11:05:13.070

1"I have the host key" - That's quite broad. What format? + Why don't you just compare the fingerprint on the WinSCP prompt? – Martin Prikryl – 2017-06-01T11:34:00.177

I have the known_hosts file with the keys. I ended up doing what you suggested, I just found it a hassle, would rather have WinSCP handle that for me. – Mr. Roland – 2017-06-01T11:45:57.887

Answers

5

WinSCP does not use known_hosts file. Like PuTTY, it stores known host keys into Windows registry (or optionally an INI file)

[HKEY_CURRENT_USER\SOFTWARE\Martin Prikryl\WinSCP 2\SshHostKeys]

The format of the keys is different to that of known_hosts.

If you have the host key cached on another machine, you can copy it over to the new machine.


You can also import host keys from known_hosts file.


Another way is to have WinSCP save new site with a known fingerprint of the host key, like:

winscp.exe sftp://username;fingerprint=ssh-rsa-xxxxxxxxxxx...=@example.com/;save

See https://winscp.net/eng/docs/integration_url#save

Martin Prikryl

Posted 2017-06-01T09:58:37.590

Reputation: 13 764

1Suggestion: create a possibility to add known host keys to WinSCP, either through a file or settings option. – Mr. Roland – 2017-06-01T11:44:43.500