4

The known_hosts file does not look trivial. On Windows I see it contains hostname, ip address and some RSA key.

On linux I see it contains several keys separated by bar.

Who manages this file on Windows? How to add some host as "known" to this file on Windows?

Can Putty do this? If Putty has some host as known, can I copy this host record from Putty database to ~/.ssh/known_hosts on Windows?

hey
  • 146
Dims
  • 13,414

2 Answers2

4

PuTTY stores the known hosts in the Windows Registry. In the FAQ, they offer a Python script to convert an existing known_hosts file to a Windows .REG file, but adding to ~/.ssh/known_hosts won't add to the hosts that PuTTY trusts.

You can also add hosts individually by connecting via PuTTY and clicking Yes on the PuTTY Security Alert. To do this, either open the PuTTY GUI and fill out the required fields to connect, or invoke it from the command line: putty.exe username@hostname port

chustedde
  • 43
  • 5
0

In Windows 10 Pro, you can add Open SSH Client from Settings -> Apps -> Optional features. This gets you both ssh-keygen and ssh-keyscan.

In my case, I had to first run ssh-keygen to get me the key pair in %HOMEPATH%\.ssh. I then uploaded the public key file to the host I want to connect to as per their instructions.

Then in a command prompt in my .ssh directory, I ran ssh-keyscan [host] > known_hosts.

(I could then connect automagically from a simple python script using paramiko.)

RolfBly
  • 121