Add a Key to the Client Known Hosts List
By default, the first time a client attempts to connect to the server, the user sees a message indicating that this is an unknown host. This message includes a fingerprint that identifies the host key. To be sure that this is actually the correct host key, the user should contact the host system administrator who can confirm that this is the correct fingerprint. Without this verification, the client is at risk of a "man-in-the-middle" attack. To simplify initial connections and eliminate the risk created by allowing users to accept unknown keys, you can manually add the host key to the client known hosts list.
To add the server key to the client known hosts list
Note: You will need a correctly named copy of the server's public host key. Client copies of known host keys use the following file name format:
Where port is the port used for the ssh connection, host is the host name, and IP is the host IP address. (Earlier versions used key_port_host.pub, and this format is still supported.)
An easy way to obtain a correctly named key is to make an initial connection to the server and allow the client to accept and name the host key. You can then distribute this copy of the host key. This is the technique used in the following procedure.