Check Public Key Fingerprint using ssh-keygen

Check Public Key Fingerprint using ssh-keygen

Verifying the fingerprint of a public key is an essential step in ensuring secure access and preventing unauthorized connections. Each public key has a unique fingerprint that serves as its identifier, making it easier to confirm that the key you're using is the correct one. This tutorial demonstrates how to check public key fingerprint using ssh-keygen.

Let's assume we have the following public key stored in the id_rsa.pub file:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDFHi1gv5z+7K7I/ziOpM6FAjAPQwUtfc+0uR6Cw9PVwR/pgtq0Y03MzHX2vf+oxDW2464S3WbkDPK+VvQ+ofmGjmdeeaMPxLwn7alxMbUCC/jvpeCw5YtJ7mzUaooF6R/GCK8jeLIJSMd4P03UvwxAdmixmbHyGXagzZ9y1q5SwQ== root@4a91a6bfd646

We can use the -l option with ssh-keygen command to get the fingerprint of a public key file:

ssh-keygen -l -f id_rsa.pub

Here, the fingerprint is shown in SHA-256 format (the default):

1024 SHA256:C/ATpXkBSz/Wv1scv+8RugqRqHD2x7wFiTZx3vIBxo8 root@4a91a6bfd646 (RSA)

If you prefer to see the fingerprint using the MD5 algorithm, add the -E md5 option:

ssh-keygen -l -E md5 -f id_rsa.pub

Output might look like this:

1024 MD5:f7:a2:38:b3:64:73:26:5f:18:df:0f:89:1f:a1:0d:f2 root@4a91a6bfd646 (RSA)

Leave a Comment

Cancel reply

Your email address will not be published.