Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I always find that I get this message when I ssh into a new machine:


What does it stand for? Will every machine have the same fingerprint every time?

How are these fingerprints generated? What parameters do they depend on?

share|improve this question

3 Answers 3

up vote 13 down vote accepted

The fingerprint is based on the Host's Public key, usually based on "/etc/ssh/ssh_host_rsa_key.pub" Generally its for easy identification/verification of the host you are connecting to.

If the fingerprint changes, the machine you are connecting to has changed their public key. This may not be a bad thing(happens from re-installing ssh), but it could also indicate that you are connecting to a different machine at the same domain/IP(happens when you are connecting through something like load balancer) or that you are being targeted with a man-in-the-middle attack, where the attacker is somehow intercepting/rerouting your ssh connection to connect to a different host which could be snooping your user/pw.

Bottom line: if you get warned of a changed fingerprint, be cautious and double check that you're actually connecting to the correct host over a secure connection. Though most of the time this is harmless, it can be an indication of a potential issue

See: http://www.lysium.de/blog/index.php?/archives/186-How-to-get-ssh-server-fingerprint-information.html
and: http://en.wikipedia.org/wiki/Public_key_fingerprint

share|improve this answer

You can generate a fingerprint for a public key using ssh-keygen like so:

ssh-keygen -lf /path/to/key.pub

Concrete example (if you use an RSA public key):

$ ssh-keygen -lf ~/.ssh/id_rsa.pub
2048 00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff /Users/username/.ssh/id_rsa.pub (RSA)

The first part (2048) is the key length in bits, second part (00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff) is the fingerprint of the public key and the third part is location of the public key file itself.

share|improve this answer
do u know how to translate into 12:f8:7e:78:61:b4:bf:e2:de:24:15:96:4e:d4:72:53 this format from that public key? –  Kit Ho Jul 24 '12 at 16:37
@KitHo I'm not sure if I understand your question. I updated the example, as I think ssh-keygen -lf will do what you want. –  Benjamin Oakes Jul 24 '12 at 18:53
Supposing the two don't match, what's the next step to determine if you made a dumb mistake or if there is a man in the middle? –  Michael Aug 5 at 23:01
When SSH-ing into a new machine, what one sees is not a user's pubkey fingerprint, but the host's pubkey fingerprint. So a better example for the question's context is ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub. It shows the fingerprint that is also shown on SSH logins to localhost. –  tanius Aug 25 at 0:26

The fingerprint is the MD5 of the Base64-encoded public key.

$ ssh-keygen -f foo
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in foo.
Your public key has been saved in foo.pub.
The key fingerprint is:
65:30:38:96:35:56:4f:64:64:e8:e3:a4:7d:59:3e:19 andrew@localhost
The key's randomart image is:
+--[ RSA 2048]----+
|       +*..+*    |
|      =. +.=     |
|     . . .o .    |
|         o+   E  |
|        S= . + o |
|        . o o +  |
|           .   . |
|                 |
|                 |
$ cat foo.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEbKq5U57fhzQ3SBbs3NVmgY2ouYZfPhc6cXBNEFpRT3T100fnbkYw+EHi76nwsp+uGxk08kh4GG881DrgotptrJj2dJxXpWp/SFdVu5S9fFU6l6dCTC9IBYYCCV8PvXbBZ3oDZyyyJT7/vXSaUdbk3x9MeNlYrgItm2KY6MdHYEg8R994Sspn1sE4Ydey5DfG/WNWVrzFCI0sWI3yj4zuCcUXFz9sEG8fIYikD9rNuohiMenWjkj6oLTwZGVW2q4wRL0051XBkmfnPD/H6gqOML9MbZQ8D6/+az0yF9oD61SkifhBNBRRNaIab/Np7XD61siR8zNMG/vCKjFGICnp andrew@localhost
$ echo 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDEbKq5U57fhzQ3SBbs3NVmgY2ouYZfPhc6cXBNEFpRT3T100fnbkYw+EHi76nwsp+uGxk08kh4GG881DrgotptrJj2dJxXpWp/SFdVu5S9fFU6l6dCTC9IBYYCCV8PvXbBZ3oDZyyyJT7/vXSaUdbk3x9MeNlYrgItm2KY6MdHYEg8R994Sspn1sE4Ydey5DfG/WNWVrzFCI0sWI3yj4zuCcUXFz9sEG8fIYikD9rNuohiMenWjkj6oLTwZGVW2q4wRL0051XBkmfnPD/H6gqOML9MbZQ8D6/+az0yF9oD61SkifhBNBRRNaIab/Np7XD61siR8zNMG/vCKjFGICnp' \
    | base64 -D | md5

The md5sum 6530389635564f6464e8e3a47d593e19 is the fingerprint displayed when the key is generated, only without the separating colons.

However, if you’re dealing with the fingerprints that Amazon shows in the EC2 Key Pairs console, unfortunately that may be a different beast. If it’s 32 bytes, it’s the standard MD5 SSH public key fingerprint above. But if it’s 40 bytes, it’s actually a fingerprint computed by taking the SHA1 of the private key in PKCS#8 format:

$ openssl pkcs8 -in foo -nocrypt -topk8 -outform DER | openssl sha1 -c
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.