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

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

我已经导航至/home/某些用户/.ssh/文件夹中找到一个名为已知主机

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

答案1

该文件的用途known_hosts在以下位置有详细描述man ssh

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

相关内容