#!/usr/bin/expect -f
# Author: Iain Douglas <centos@1n6.org.uk>
set timeout 10
match_max 6000
spawn su passtest -c passwd
expect "UNIX password:" { send -- "passtest\r" }
expect {
"You must wait longer to change your password"
{
exit 2
}
"Authentication token manipulation error"
{
exit 3
}
"password:"
{
send -- "ano24ther\r"
expect "*?password:*"
send -- "ano24ther\r"
expect eof
}
}