运维工作常用命令
时间:2014-10-15 03:33:01
收藏:0
阅读:212
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
评论(0)