Run the following command to retrieve the SHA256 fingerprint of your SSH key ( -l
means "list" instead of create a new key, -f
means "filename"):
(运行以下命令以检索SSH密钥的SHA256指纹( -l
表示“list”而不是创建新密钥, -f
表示“filename”):)
$ ssh-keygen -lf /path/to/ssh/key
So for example, on my machine the command I ran was (using RSA public key):
(例如,在我的机器上,我运行的命令是(使用RSA公钥):)
$ ssh-keygen -lf ~/.ssh/id_rsa.pub
2048 00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff /Users/username/.ssh/id_rsa.pub (RSA)
To get the GitHub (MD5) fingerprint format with newer versions of ssh-keygen, run:
(要使用较新版本的ssh-keygen获取GitHub(MD5)指纹格式,请运行:)
$ ssh-keygen -E md5 -lf <fileName>
Bonus information:
(奖金信息:)
ssh-keygen -lf
also works on known_hosts
and authorized_keys
files.
(ssh-keygen -lf
也适用于known_hosts
和authorized_keys
文件。)
To find most public keys on Linux/Unix/OS X systems, run
(要在Linux / Unix / OS X系统上查找大多数公钥,请运行)
$ find /etc/ssh /home/*/.ssh /Users/*/.ssh -name '*.pub' -o -name 'authorized_keys' -o -name 'known_hosts'
(If you want to see inside other users' homedirs, you'll have to be root or sudo.)
((如果你想看到其他用户的homedirs内部,你必须是root或sudo。))
The ssh-add -l
is very similar, but lists the fingerprints of keys added to your agent.
(ssh-add -l
非常相似,但列出了添加到代理的密钥的指纹。)
(OS X users take note that magic passwordless SSH via Keychain is not the same as using ssh-agent.) ((OS X用户注意到通过Keychain进行魔术无密码SSH与使用ssh-agent不同。))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…