What is a 'known_hosts' file and what does it contains

Solution 1:

The purpose of the known_hosts file is described quite well in 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.