You probably have seen images like these while working with OpenSSH. These cryptic characters are called Randomart images.
Images taken from What is randomart?
Why is this interesting to us?
Well let's suppose you have a long list of keys… like the one at your servers ~/.ssh/known_hosts/ and you want to visually check if you have a duplicate.
try this simple command:
$ssh-keygen -lv -f ~/.ssh/known_hosts | lessAnd you will get a nice random art like this: (look how easy is to spot the duplicate one)
Which is much easier to read than the original output (generated via less ~/.ssh/known_hosts )
Details
In case you’re wondering exactly what the ssh-keygen command is doing, look no further than it’s manpage
-l Show fingerprint of specified public key file. Private RSA1 keys are also
supported. For RSA and DSA keys ssh-keygen tries to find the matching public key
file and prints its fingerprint. If combined with -v, an ASCII art representation
of the key is supplied with the fingerprint.More Tips
By adding this to your ~/.ssh/config:
VisualHostKey yes
Or by adding this option in your ssh command
$ ssh -o VisualHostKey=yes your.host.name
Will configure ssh to display a server’s randomart during login (handy to ensure you are deploying to the right server, hehe).
If you find this tip useful, please buy these awesome devs a beer, they’ve earned it!
Originally published at sanscourier.com