-
#!/usr/bin/expect
-
-
set allhosts [open hosts.txt r]
-
foreach all [read $allhosts] {
-
puts "$all"
-
set passwd "123456"
-
set newpasswd "12345678"
-
spawn /usr/bin/ssh root@$all
-
-
expect {
-
"yes/no" { send "yes\r"; exp_continue}
-
"Password: " { send "$passwd\r" }
-
}
-
-
expect "#"
-
send "export LANG=\"en_US\"\r"
-
-
expect "#"
-
send "passwd\r"
-
-
expect "password:"
-
send "$newpasswd\r"
-
-
expect "password:"
-
send "$newpasswd\r"
-
}
-
expect eof
-
close $allhosts
-
- exit