首页 > 其他分享 >免密脚本

免密脚本

时间:2023-02-22 10:57:57浏览次数:25  
标签:脚本 node 免密 rsa export ssh root id

yum install sshpass -y

if [ ! -f /root/.ssh/id_rsa ]; then
  ssh-keygen -t rsa -b 2048 -N '' -f /root/.ssh/id_rsa > /dev/null
fi

export NODE_NAMES=(master1 master2 master3 node1 node2 node3)
export pwd="rootpassword"

for node in ${NODE_NAMES[@]}
  do
    echo ">>> ${node}"
    sshpass -p ${pwd} ssh-copy-id -o StrictHostKeyChecking=no root@${node} 2>/dev/null
  done

标签:脚本,node,免密,rsa,export,ssh,root,id
From: https://www.cnblogs.com/xwjh/p/17143566.html

相关文章