前提:做SSH 无密码验证
可以使用securCRT软件多窗口操作,给所有需更改的服务器添加信任
cat< <EOF > /root/.ssh/authorized_keys
ssh-rsa
AAAAB3NzaC1yc2EAAAABIwAAAQETvvyoGyBKU4VX4tNyGM+8F4k0d+Fdfg443NxBseRV73FGU8787SmhMaF9ytiY2VAL5iCZmLO4NecforA4P6IpGvzAwDnjM/J0MuhAHCoIHiNqwl5Y1Q6bWj8auXPet+AIw/vNIgorebbIGjZT4sdfsdfWzmYGLmF9ZqnPr8xPm2OjPwTnJsdfggKfEhofLOIHS6HmsKhn4UUogbVaRiZQ4qKf2t5tdfgxc1X8NIVxfnzVYzAxnEUsLsdfM7TK2sfxm7sdfsdfasds11Z8eQD3Q== elain@elain-pc
EOF
通过以上方法即可添加,或参考:
cat update_passwd.sh
exec 3<iplist
while read -u3 line
do
IP=`echo $line|awk "{print $1}"`
PASS=`echo $line|awk "{print $2}"`
echo "========$IP========"
ssh -p 22 root@$IP "echo $PASS| passwd --stdin root"
done
cat iplist
10.0.2.50 admintest1
10.0.2.50 admintest3
10.0.2.50 admintest5
10.0.2.50 admintest5
10.0.2.50 admintest5
阅读(586) | 评论(0) | 转发(0) |