简易版本一键免密登陆(通过ssh-copy-id)

简易版本一键免密登陆(通过ssh-copy-id)

  1. 修改主机名配置hosts
cat >>/etc/hosts<<EOF    #添加各个节点hosts解析
172.20.2.222      cm-server
172.20.2.203      hadoop-1
172.20.2.204      hadoop-2
172.20.2.205      hadoop-3
EOF
  1. 配置cm-server免密钥登录其他节点
ssh-keygen -t rsa     #在cm-server生成密钥对
for num in `seq 1 3`;do ssh-copy-id -i /root/.ssh/id_rsa.pub root@hadoop-$num;done
posted @ 2022-09-03 21:50  つつつつつつ  阅读(52)  评论(0编辑  收藏  举报