Find your SSH keys based on their fingerprint

I’m a sloppy guy, I have a tendency to forget things. I work in more than one computer, and at the time of writing this post I’m not using a password manager like gopass (yes, I hate myself that much). That has given me the opportunity to create a small chaotic environment when it comes to manage passwords and keys. It got to the point where I could’t differentiate between my ssh keys, different machines, accounts, and similar key names.

So if your trying to figure out which public key that lol:lal:lel:023:lol fingerprint represents, you’re in the right place.


A fingerprint is the MD5 hashing over the binary data within the base64-encoded ssh public key, meaning it unmistakably identifies it.

Managing keys on Github

So, genius as I am, at some point in time I decided that naming this key ssh would be enough for me to identify it later on. That obviously was not the case.


So where should you look if you have a similar issue? The Github web UI only allows you to see your public keys fingerprint, and based on that you can find the correspondent public key.

Running the following command allows you to get the fingerprint of a given key. With this you can easily find all the key fingerprints inside your .ssh directory.

ssh-keygen -E md5 -lf ~/.ssh/<key_name>.pub

The Github API is more permissive than the web interface and you can actually retrieve your public keys directly from it.

This one liners can be useful.

# to list all your key fingerprints
curl -sL<user>.keys | while read; do ssh-keygen -E md5 -lf - <<<"$REPLY"; done | awk '{print $2}'

# to list all your public keys
curl -sL<user>.keys | while read; do echo "$REPLY\n"; done 

Hope this helps.

· ssh, github