Is there a definitive path for known hosts in Windows?

Look in ~\Users\~\AppData\Roaming\_ssh\known_hosts.

See also: http://comments.gmane.org/gmane.comp.web.curl.general/12593


The ~/.ssh/known_hosts is a *nix path used by OpenSSH. The ~ is resolved to the account's home directory, which is specified in /etc/passwd file. The home defaults to /home/username folder on Linux.


The OpenSSH is Linux software. It does not run on Windows on its own.

Though it can run on *nix emulation on Windows and there are also Windows clones of OpenSSH. So in the end, your question is about what emulation or clone do you run on the Windows server and how that maps/re-implements the access to ~/.ssh/known_hosts.

  • Win32-OpenSSH (Windows clone of OpenSSH by Microsoft): It goes to your Windows account profile folder. I.e. typically to C:\Users\username\.ssh.

    See also my guide for Setting up SSH public key authentication on Win32-OpenSSH.

  • Cygwin emulator: On my installations, all *nix-like paths are actually stored in C:\cygwin64 (C:\cygwin on 32-bit).

    So the /home/username/.ssh/known_hosts is in C:\cygwin64\home\username\.ssh\known_hosts.


Note that Windows SSH clients usually do not use the known_hosts. They have a different host key cache/storage.

For example widely used Windows SSH client, PuTTY, stores know host keys to Windows registry to HKCU\Software\SimonTatham\PuTTY\SshHostKeys key. For details, see the answer by @aneesh.