For yourself?
Get a list of all the boxes in a file, either IPs or hostnames.
The expect script would look something like:
Code:
#!/usr/local/bin/expect --
spawn telnet [lindex $argv 0]
expect ogin:
send loginName\r
expect ssword:
send yourPasswd\r
expect yourprompt
send "passwd loginName\r"
expect ssword:
send yourPasswd\r
expect ssword:
send newPasswd\r
expect ssword:
send newPasswd\r
expect yourPrompt
send exit\r
expect close
exit 0
The above example assumes that the passwd command is going to first ask you for your passwd, then you'll have to enter the new passwd twice.
Before you run it against all boxes, test it with one box. Make sure you log into the box first on another terminal, just in case.
Code:
myscript.exp hostname
If no issues, remove the hostname from your sever list, then do
Code:
for x in $(cat boxList.txt); do
myscript.exp $x
done
Quick note, if your prompt is $ or ends in $, you need to comment it out in the expect script., so expect sees it as a regular character. Otherwise it'll go very slow.