进入一台ubuntu服务器ubuntu1
2
ssh-keygen -t rsa #一直回车
3
cd .ssh
4
cat id_rsa.pub >> authorized_keys
5
#将生成的公钥传到ubuntu2机器
scp id_rsa.pub ubuntu@ubuntu2:/home/ubuntu/opt/id_rsa.pub
6
#进入ubuntu2机器
cd ~
7
ssh-keygen -t rsa #一直回车
8
cd .ssh
9
cat id_rsa.pub >> authorized_keys
10
#完成ubuntu1到ubuntu2的无密码访问
cat /home/ubuntu/opt/id_rsa.pub >>authorized_keys
11
#将ubuntu2的公钥传到ubuntu1
scp id_rsa.pub ubuntu@ubuntu1:/home/ubuntu/opt/id_rsa.pub
12
#进入ubuntu1机器
cd ~/.ssh
13
#完成ubuntu2到ubuntu1的无密码访问
cat /home/ubuntu/opt/id_rsa.pub >>authorized_keys
本文出自 “XFICC” 博客,请务必保留此出处http://xficc.blog.51cto.com/1189288/1565859
原文地址:http://xficc.blog.51cto.com/1189288/1565859