centos多节点root间ssh免密法登陆
假如有4个结点. node1,node2,node3,node4
1.在每个结点执行,生成rsa密钥
# ssh-keygen -t rsa -P ''
2.在每个结点执行,将每台结点上的公钥拷贝到node1的authorized_keys文件中。
# ssh-copy-id -i ~/.ssh/id_rsa.pub root@node1
3.在node1上执行,将node1上的~/.ssh/authorized_keys,~/.ssh/known_hosts 文件拷贝到其他结点
# scp ~/.ssh/authorized_keys root@node2:/root/.ssh/authorized_keys
# scp ~/.ssh/authorized_keys root@node3:/root/.ssh/authorized_keys
# scp ~/.ssh/authorized_keys root@node4:/root/.ssh/authorized_keys
# scp ~/.ssh/known_hosts root@node2:/root/.ssh/known_hosts
# scp ~/.ssh/known_hosts root@node3:/root/.ssh/known_hosts
# scp ~/.ssh/known_hosts root@node4:/root/.ssh/known_hosts