Establishing trust between two hosts involves exchanging their public keys and adding them to each other’s /etc/ssh/ssh_known_hosts file.


The /etc/ssh/ssh_known_hosts file provides an association between a host identifier (name or IP address) and a public key.

The format of ssh_known_hosts is the same as the format of the ssh_known_hosts files that resides in the user’s $HOME/.ssh directory.

The ssh_known_hosts file contains entries similar to the one shown in the following example:, ssh-rsa

The first element in the entry represents a host identifier (in this case, The second element represents the key type (ssh-rsa). The third element represents the public key of that host. The entry may have additional elements, but they not are relevant to this discussion.

By adding such entries to the /etc/ssh/ssh_known_hosts file, system administrators establish a one way trust between the host where the key is added and the host whose key is added. In the preceding example, the host where the entry is inserted in /etc/ssh/ssh_known_hosts trusts the host identified by (or IP address

In order to establish two way trust between two hosts, the /etc/ssh/ssh_known_hosts file of each host must be updated with the public keys of the other host.

In the /etc/ssh/ssh_known_hosts file, an SSH host public key is associated with a host identifier, usually a host name or IP address. However, in the case of the compute nodes, they all have different host names and IP addresses, but they all have the same SSH host keys. An easy way to associate the compute nodes’ SSH host keys with a host name is to introduce a special host name that identifies all the compute nodes (for example, compute-nodes) and associate the SSH host public key from the compute node image with that host identifier.