Can someone help me out with expect script for mass password change...
Here is my script....
#!/usr/bin/expect --
spawn $env(SHELL)
expect -exact "\$ "
send -- "/usr/bin/ssh [lindex $argv 0] 'passwd hp '\r"
expect "Password:"
send "rep123"
expect "New Password:"
send "rep123"
expect "Re-enter new Password:"
send "rep123"
expect "Password:"
send -- $env(PASS)\r
expect "\$ "
-------------------------
from my console i am running following....
for i in `cat linux.lst` ;do ./khp root@$i ; done
Following apperas on my screen...
spawn /bin/ksh
# /usr/bin/ssh root@ub1nas3p 'passwd hp '
Password:
Password:
and password does not change. though i have specified the argument in the script that about password, new password and Re-enter new password. i dont understand why its asking password twice and does not change the password ?
Your help is highly appericated.
Thanks
HP
Here is my script....
#!/usr/bin/expect --
spawn $env(SHELL)
expect -exact "\$ "
send -- "/usr/bin/ssh [lindex $argv 0] 'passwd hp '\r"
expect "Password:"
send "rep123"
expect "New Password:"
send "rep123"
expect "Re-enter new Password:"
send "rep123"
expect "Password:"
send -- $env(PASS)\r
expect "\$ "
-------------------------
from my console i am running following....
for i in `cat linux.lst` ;do ./khp root@$i ; done
Following apperas on my screen...
spawn /bin/ksh
# /usr/bin/ssh root@ub1nas3p 'passwd hp '
Password:
Password:
and password does not change. though i have specified the argument in the script that about password, new password and Re-enter new password. i dont understand why its asking password twice and does not change the password ?
Your help is highly appericated.
Thanks
HP