Life's random bits By b1thunt3r (aka Ishan Jain)…
Get SSH Server Key Fingerprint

Get SSH Server Key Fingerprint

Ishan jain
Obtain SSH server key fingerprint without trying to login to the server.

To prevent man-in-the-middle attacks, SSH server have private keys. This private key is used to secure the session between the client and the server. Public keys for these servers are stored in ~/.ssh/known_hosts file on the client machine.

You can get the fingerprint with the following command:

$HOST=<hostname>; ssh-keyscan host | ssh-keygen -lf -

Where:

  • hostname: server IP or hostname

For example, in the following command we can get the key fingerprints for example.com:

$HOST=example.com; ssh-keyscan host | ssh-keygen -lf -