主机A

生成密钥

ssh-keygen -t rsa

一路回车(默认生成)

cd /root/.ssh

进入密钥目录

scp id_rsa.pub root@B主机IP:/root/.ssh/authorized_keys

rm -rf id_rsa.pub

 

主机B

ssh-keygen -t rsa

一路回车(默认生成)

cd /root/.ssh

scp id_rsa.pub root@A主机IP:/root/.ssh/authorized_keys

 rm -rf id_rsa.pub