linux服务器之间免密码登录
服务器:
192.168.23.151、192.168.23.152、192.168.23.153、192.168.23.154、192.168.23.155、192.168.23.156
从151到其他服务器免密码登录,在151上执行下面的语句,一直回车即可
ssh-keygen -t rsa
在151上依次执行下面语句
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.23.152 ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.23.153 ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.23.154 ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.23.155 ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.23.156
备注:
有时会有问题,比如执行start-dfs.sh报错:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)
解决方法:在每一台机器上执行相同的命令(6台机器上执行相同的命令,如下):
ssh-keygen ssh-copy-id 192.168.23.151(输入yes,node1的密码) ssh-copy-id 192.168.23.152(输入yes,node2的密码) ssh-copy-id 192.168.23.153(输入yes,node3的密码) ssh-copy-id 192.168.23.154(输入yes,node4的密码) ssh-copy-id 192.168.23.155(输入yes,node5的密码) ssh-copy-id 192.168.23.156(输入yes,node6的密码)