原创

ssh实现秘钥登陆

温馨提示:
本文最后更新于 2021年06月02日,已超过 1,058 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我

2行命令

ssh-keygen #生成本地秘钥
ssh-copy-id -i ~/.ssh/id_rsa.pub root@ip地址

输入密码,即可将公钥追加到新的服务器中

[root@MiWiFi-RA69-srv ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@47.106.110.119
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@47.106.110.119's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@47.106.110.119'"
and check to make sure that only the key(s) you wanted were added.
正文到此结束
本文目录