首先在客户端上生成密钥对
[root@localhost ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): # 直接回收保存在默认路径
Enter passphrase (empty for no passphrase): # 如果将密码留空,可以用私钥进行身份验证,登录时不需要再输入密码。如果输入密码了,需要私钥和密码才能登陆。使用密码保护密码会更加安全。
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Ot1VM6XM0Cat1dm75ZWPqWx+mSNo04aHDNwqm7p0Q6k root@localhost.localdomain
The key`s randomart image is:
+---[RSA 2048]----+
| .o .+|
| .+=+o|
| =B o|
| . .. =o|
| o.S. . +=|
| o oo... o.o|
| E = .+.* . o |
| . ..+. B O = |
| oooo . *.o . |
+----[SHA256]-----+
# 将会在当前用户主目录中生成id_rsa私钥和id_rsa.pub公钥
[root@localhost ~]# ls /root/.ssh/
id_rsa id_rsa.pub known_hosts
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。