三台机器之间ssh互信配置
环境介绍:
192.168.65.128 my1-222192.168.65.129 my2-223192.168.65.130 web224# 步骤一:# 每个节点执行cat >>/etc/hosts <<EOF192.168.65.128 my1-222192.168.65.129 my2-223192.168.65.130 web224EOF# 每个节点都执行ssh-keygen -t rsa # 一路回车# 将公钥添加到认证文件中cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys# 并设置authorized_keys的访问权限chmod 600 ~/.ssh/authorized_keys# 只要在一个节点执行即可。这里在 192.168.65.128上执行ssh 192.168.65.129 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keysssh 192.168.65.130 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys# 分发整合后的文件到其它节点scp ~/.ssh/authorized_keys 192.168.65.129:~/.ssh/scp ~/.ssh/authorized_keys 192.168.65.130:~/.ssh/# 测试时,第一次,需要输入密码,之后就不需要输入密码了。# 在192.168.65.128上测试ssh 192.168.65.129ssh 192.168.65.130# 在192.168.65.129上测试ssh 192.168.65.128ssh 192.168.65.130# 在192.168.65.130上测试ssh 192.168.65.128ssh 192.168.65.129# 删除,重新操作# rm -fr /root/.ssh/