The original /usr/bin/autopasswd, which should make it easy to change
passwords from scripts doesn't work as expected with passwd command, that
is supplied with redhat in package passwd. The fixed and working version
should look like this:
# wrapper to make passwd(1) be non-interactive
# username is passed as 1st arg, passwd as 2nd
set password [lindex $argv 1]
spawn passwd --stdin -f [lindex $argv 0]
expect "Changing password"
This is still an issue in expect-5.39.0-93.
Actually with pam even that won't work as the messages vary and
sometimes are not automatable (eg "insert smartcard now")
Removed autopasswd example.