#ssh-keygen -t rsa -P "" -f /root/.ssh/id_rsa yum install -y expect
#for i in `cat ip.txt`;do #mkdir ip.txt
#name=(node-61 node-62 node-63) name=(node-61 node-62 node-63) for i in ${name[@]}; do expect -c " spawn ssh-copy-id -i /root/.ssh/id_rsa.pub root@$i expect { \"*yes/no*\" {send \"yes\r\"; exp_continue} \"*password*\" {send \"${passwd}\r\"; exp_continue} \"*Password*\" {send \"${passwd}\r\";} }" done
#no rsa #!/bin/bash #env passwd=123456
yum install -y sshpass #name=(node-61 node-62 node-63) name=(node-61 node-62 node-63) for i in ${name[@]}; do sshpass -p ${passwd} ssh -o "StrictHostKeyChecking no" systemusers@${i} "sudo /usr/sbin/shutdown -h now" done