文章摘要:ubuntu如何获取sshkey Ubuntu如何获取安装软件权限
ubuntu获取sshkey的方法: 1.打开终端命令行。 2.输入以下命令。 ssh-keygen -t r […]
ubuntu获取sshkey的方法:
1.打开终端命令行。
2.输入以下命令。
ssh-keygen -t rsa -C "your_email@example.com" //your_email@example.com为你在GitHub或者GitLab注册时的邮箱
2.执行后,终端会显示如下结果,按回车保存。
Created directory '/Users/xxx/.ssh'.
Enter passphrase (empty for no passphrase):
3.提示设置 passphrase,设置成功后会显示:
Your identification has been saved in /Users/xxx/.ssh/id_rsa.
Your public key has been saved in /Users/xxx/.ssh/id_rsa.pub.
The key fingerprint is:
16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48 your_email@example.com
The key's randomart image is:
心形图形
4.接着在终端输入以下命令:
ssh-add ~/.ssh/id_rsa
5.按要求填刚刚设置的passphrase,成功后会显示:
Identity added: /Users/xxx/.ssh/id_rsa (/Users/xxx/.ssh/id_rsa)
6.最后再输入以下命令就可以获取你的sshkey了,命令如下:
cat /Users/xxx/.ssh/id_rsa.pub