Linux SSH 无密码登录

1. ssh-keygen -t rsa

2. scp root@ip:/root/.ssh/id_rsa.pub ./id2

3. cat id2 >> authtorized_keys

4. systemctl restart sshd

5. switch to another machine, ssh root@ip

 

在另一机器上重复以上操作, 其中最关键的是2,3.  一定要用scp 拷贝文件后,通过>>复制秘钥。

而不能通过复制粘贴直接在两个authorized_keys文件中拷贝。否则无效。

posted @ 2017-10-25 09:51  jaystarba  阅读(176)  评论(0编辑  收藏  举报