expect script to change user password
hi,
i have written a small expect script to change the user passwod.
#!/usr/bin/expect
spawn passwd [lindex $argv 0]
set password [lindex $argv 0]
expect "password:"
send "$password\r"
expect "password:"
send "$password\r"
expect eof
when i execute the above script has
./test.sh testuser Welcom@123
it is giving the below error and password is not getting changed
./test.sh testuser Welcome@123
spawn passwd testuser
Changing password for user testuser.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
Could you please correct the issue, where i am wrong
thanks in advacne
thanks
Sheri
|