Saturday, January 8, 2022

[SOLVED] How do I know which ssh key is used in my github account?

Issue

When I go to the SSH keys page in my GitHub account, I see a key whose identity starts with "c5:42:08:9d:39:22..."

On my computer, in the ".ssh" folder, I have several files that look like public SSH keys, but none of them contains a string similar to the above. For example, one of the files "id_rsa.pub" contains a string that starts with "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABA..." there are other similar files that probably represent different keys.

How can I identify which of the files, if any, represents the actual key that is in my github account?


Solution

The c5:42:08:9d:39:22... value isn't your key itself, but rather its fingerprint. You can see your keys' fingerprints using the ssh-keygen utility, e.g.

ssh-keygen -lf ~/.ssh/id_rsa -E sha256

Here we specify that we want to see the key's fingerprint (-l), we provide a path to the key whose fingerprint we want to see (-f ~/.ssh/id_rsa), and we specify that we want to see the SHA256 fingerprint rather than another hash like MD5 (-E sha256) since that's what GitHub shows in its web interface.

You should get the same fingerprint from the public part as from the private part of the keypair.



Answered By - Chris