运维工作常用命令

时间:2014-10-15 03:33:01   收藏:0   阅读:212


  1. 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
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!