sshのキーファイルのfingerprint値が知りたい場合h、ssh-keygenコマンドに-lと-fを指定することで出力させることが可能です。最近のssh-keygenコマンドはSHA256の値を出力してくれるのですが、外部サービスに登録したキーを確認したい時など、場合によってはMD5形式(16進数が2文字すづ転んで区切られた形式)で出力してほしい場合もあります。
$ ssh-keygen -l -f ~/.ssh/id_rsa
2048 SHA256:hOBz7... ec2-user@aws
このような場合は"-E md5"オプションを使うことで期待した出力を得ることができます。
$ ssh-keygen -l -E md5 -f ~/.ssh/authorized_keys
2048 MD5:ca:fe:ba:... ec2-user@aws
2048 MD5:de:ad:be:... root@local
ちなみにこのコマンドはid_rsa(秘密鍵)でも、id_rsa.pub(公開鍵)のファイルに対してでも使えます。
$ ssh-keygen -l -E md5 -f ~/.ssh/id_rsa
2048 MD5:ca:fe:ba:... key1
$ ssh-keygen -l -E md5 -f ~/.ssh/id_rsa.pub
2048 MD5:ca:fe:ba:... key1
それぞれのオプションの意味は下記の通りです。
-l Show fingerprint of specified public key file. For RSA and DSA keys
ssh-keygen tries to find the matching public key file and prints its
fingerprint. If combined with -v, a visual ASCII art representation
of the key is supplied with the fingerprint.
-f filename
Specifies the filename of the key file.
-E fingerprint_hash
Specifies the hash algorithm used when displaying key fingerprints.
Valid options are: ``md5'' and ``sha256''. The default is ``sha256''.
こちらもおススメ