Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
622 views
in Technique[技术] by (71.8m points)

ssh - 计算RSA密钥指纹(Calculate RSA key fingerprint)

I need to do the SSH key audit for GitHub, but I am not sure how do find my RSA key fingerprint.

(我需要为GitHub进行SSH密钥审核,但我不确定如何找到我的RSA密钥指纹。)

I originally followed a guide to generate an SSH key on Linux.

(我最初遵循指南在Linux上生成SSH密钥。)

What is the command I need to enter to find my current RSA key fingerprint?

(我需要输入什么命令才能找到我当前的RSA密钥指纹?)

  ask by Zakoff translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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_hostsauthorized_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不同。))


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...