Is there a specific way for known hosts on Windows?

I work with libcurl as SFTP and excellent. I want to check if the host should connect if it exists in the hosts file. On Linux, I can easily find the known hosts file, since it is almost always located in ~/.ssh/known_hosts . I wanted to know if Windows supports the same thing, or not the standard as to where such a file resides on Windows.

+7
source share
3 answers

~/.ssh/known_hosts is the * nix path used by OpenSSH. ~ converted to the account home directory, which is specified in the /etc/passwd . By default, this is the /home/username folder.


OpenSSH is software for Linux. It does not work on Windows by itself.

Although it can work on * nix emulation on Windows, there are also Windows OpenSSH clones. So, at the end, your question is about which emulation or clone you are running on the Windows server and how it displays ~/.ssh/known_hosts access to ~/.ssh/known_hosts .

  • Win32-OpenSSH (Windows-clone of OpenSSH from Microsoft): it gets into the profile folder of your Windows account. That is, usually before C:\Users\username\.ssh .

    See also my guide on configuring SSH public key authentication in Win32-OpenSSH .

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

    Thus, /home/username/.ssh/known_hosts is located in C:\cygwin64\home\username\.ssh\known_hosts .

+6
source

Take a look at ~\Users\~\AppData\Roaming\_ssh\known_hosts .

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

+1
source

Not sure about libcurl though. But for PuTTY users, this can be useful if PuTTY issues warnings such as WARNING: Server public key has changed So there are SshHostKeys in the known_hosts window for PuTTY.

this is stored at location HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys . A Registry Editor must be used to reach this location.

  • go to start looking for regedit
  • then you will see all the directories in the left panel under the computer
  • just as this image says go to location HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys - location
  • then you can change how you want Known host parameters - delete the registry value if you see a warning: WARNING: Server public key has changed
  • If necessary, you can check the contents of the SshHostKeys file with this REG QUERY HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys

And then the cache will be cleared. Will everything be new again for this particular entry

0
source

Source: https://habr.com/ru/post/1232958/


All Articles