I can not get Expect to do the example script from the O'Reilly "Exploring
Expect" book, where it changes the password. The example is on page #5.
It won't run reliable, and about 95% of the time it just hangs when you
run the script as root.
# wrapper to make passwd(1) be non-interactive
# Usage: chpassword user newpassword
spawn passwd [lindex $argv 0]
set password [lindex $argv 1]
Look at /usr/bin/autopasswd, there's some timing races that need to be dealt
with more carefully than the O'Reilley example would suggest.