快速建立ssh互信(一主两从)
搭建一台管理机(192.168.10.101),两台被管理机(192.168.10.102、192.168.10.103)
搭建命令:
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
yum install -y sshpass
sshpass -p123456 ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.10.102 -p 22 "-o StrictHostKeyChecking=no"
sshpass -p123456 ssh-copy-id -i /root/.ssh/id_dsa.pub root@192.168.10.103 -p 22 "-o StrictHostKeyChecking=no"
#第一条命令可以换成rsa,命令是ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
测试命令:
ssh 192.168.10.102
ssh 192.168.10.103