The Server Public and Private Key

When SSH first starts after installation, it will create a key pair, namely /etc/ssh/ssh_host_rsa_key and /etc/ssh/ssh_host_rsa_key.pub, assuming that the server is using the default RSA algorithm. This public key always has a .pub ending, and resides in the /etc/ssh/ directory. The SSH server on your system uses this file to authenticate itself to anyone who logs on. The ssh-keygen command can be used to view the contents of the public key file:

$ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
1024 98:2g:h8:k9:de:9f:fg:90:34:v3:35:3j:26:24:26:7k ssh_host_rsa_key.pub

If the server is using the DSA algorithm, the key names will be as follows:

  • /etc/ssh/ssh_host_dsa_key

  • /etc/ssh/ssh_host_dsa_key.pub

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.