什么是“known_hosts”文件以及它包含什么

alt*_*3en 3 ssh security

我已导航到/home/some-user/.ssh/文件夹并找到一个名为known_hosts的文件。

该文件的用途是什么以及它包含什么?

ste*_*ver 6

该文件的用途known_hosts在以下内容中有很好的描述man ssh

\n
\n
 ssh automatically maintains and checks a database containing identifica\xe2\x80\x90\n tion for all hosts it has ever been used with.  Host keys are stored in\n ~/.ssh/known_hosts in the user's home directory.  Additionally, the file\n /etc/ssh/ssh_known_hosts is automatically checked for known hosts.  Any\n new hosts are automatically added to the user's file.  If a host's iden\xe2\x80\x90\n tification ever changes, ssh warns about this and disables password\n authentication to prevent server spoofing or man-in-the-middle attacks,\n which could otherwise be used to circumvent the encryption.  The\n StrictHostKeyChecking option can be used to control logins to machines\n whose host key is not known or has changed.\n
Run Code Online (Sandbox Code Playgroud)\n
\n