标签:运维 命令
expect+ssh 修改主机密码
for ip in `cat /tmp/myhosts`;do expect -c "spawn ssh -p33842 $ip; expect *assword* { send \"my old passwd\r\" };expect root@* {send \"echo root:‘my new password‘ |/usr/sbin/chpasswd\r\" } ;expect root@* {send \"ip addr \r\"} ;expect of " ;done
本文出自 “运维者说:从菜鸟到老鸟” 博客,请务必保留此出处http://liuqunying.blog.51cto.com/3984207/1564092
标签:运维 命令
原文地址:http://liuqunying.blog.51cto.com/3984207/1564092