[SOLVED] Verify ssh public key fingerprints

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
kwyrky
Level 1
Level 1
Posts: 46
Joined: Wed Jul 10, 2019 5:10 am

[SOLVED] Verify ssh public key fingerprints

Post by kwyrky » Mon Aug 19, 2019 7:42 am

Hi,

how can I verify ssh public key fingerprints?

Code: Select all

kwyrky@asus:~$ ssh -o visualhostkey=yes -o HostKeyAlgorithms=ssh-rsa 127.0.0.1 
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
RSA key fingerprint is SHA256:6m7H6ZjNkav+Wd8e5uDonb7LpOBh/mh+7xl2VUpaCkw.
+---[RSA 2048]----+
|          E      |
|         o       |
|          o   o .|
|           . = ..|
|        S   o . .|
|       . .     . |
|      ..*.. = +  |
|     ..O=O.X X . |
|     +BB%+=+&++  |
+----[SHA256]-----+
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.

Code: Select all

kwyrky@asus:~/.ssh$ ssh-keygen -lv -E sha256 -f id_rsa.pub 
2048 SHA256:FeprG3X+Q54pfMKi7YCEjtqo7S4ueBsIbj8JlBzwVxE kwyrky@asus (RSA)
+---[RSA 2048]----+
|o     Eo  .      |
| o   .   . .     |
|. + .   . .      |
| + . . . .       |
|o   . . S . .    |
|oo o . . o o  .  |
|oo+ o . =  o.o o |
|==o+   . =. =.*  |
|B**o.   ooo. +.. |
+----[SHA256]-----+
Those randomart images are generated from the same machine and should be equal I guess but they are not?
Last edited by kwyrky on Tue Aug 20, 2019 11:25 am, edited 1 time in total.

rene
Level 11
Level 11
Posts: 3625
Joined: Sun Mar 27, 2016 6:58 pm

Re: Verify ssh public key fingerprints

Post by rene » Mon Aug 19, 2019 8:50 am

The former command is showing you the host key fingerprint. That is, if you have the latter verify /etc/ssh/ssh_host_rsa_key instead you'll undoubtedly find them to match.

kwyrky
Level 1
Level 1
Posts: 46
Joined: Wed Jul 10, 2019 5:10 am

Re: Verify ssh public key fingerprints

Post by kwyrky » Tue Aug 20, 2019 8:45 am

Thank you that worked. Next time I connect I will check if the keys and random art images match.

Code: Select all

ssh-keygen -lv -E sha256 -f /etc/ssh/ssh_host_rsa_key

Post Reply

Return to “Newbie Questions”