本文共 621 字,大约阅读时间需要 2 分钟。
#!/bin/bash
#modfiy password#v.1.0 by chenght 2019-03-28read -p "Please enter a new password :" pass######ip.txt 为目标主机ipfor ip in $(cat ip.txt)do{ping -c1 -W1 $ip &>/dev/null if [ $? -eq 0 ];then ssh -p 10022 $ip "echo $pass |passwd --stdin root" if [ $? -eq 0 ];then echo "$ip" >> success_`date +%F`.txt echo "$pass" >> success_`date +%F`.txt else echo "$ip" >> fail_`date +%F`.txt fi else echo "$ip" >>fail_`date +%F`.txt fi
}&
donewaitecho "all ok ."转载于:https://blog.51cto.com/5776643/2370465