ubuntu如何获取sshkey

1295
2021/2/22 15:25:13
栏目: 智能运维
开发者测试专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

ubuntu如何获取sshkey

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

辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读: ubuntu ssh拒绝连接怎么解决