For reference, again because I forget these things usually, here is a simple expect script that ssh’s to a server and changes the password.

#!/usr/bin/expect
set node [lindex $argv 0]
spawn ssh $node passwd
expect "(current) UNIX password:" { send "oldpass\r" }
expect "New password: " { send "newpass\r" }
expect "Retype new password: " { send "newpass\r" }
send "exit\r"

I can call this like, “expect_chpass nodename” and voilĂ , oldpass is changed to newpass.

Now go do something less boring instead.