#!/bin/bash
for i in `cat /root/soft/ip.txt`
do
/usr/bin/expect << EOF
spawn /usr/bin/ssh root@$i
expect {
"UNIX password" { send "Huawei@123
" }
}
expect {
"New password:" { send "xxHuzzawexxi@1234#
" }
}
expect {
"Retype new password:" { send "xxHuzzawexxi@1234#
" }
}
expect "*]#"
send "echo Huawei@123|passwd --stdin root
"
expect "*]#"
send "exit
"
expect eof
EOF
done