Hello,
I was working with expect, and I came to what I presume is a trivial problem. I have the following script:
Code:
1 #!/usr/local/bin/expect
2 spawn passwd [lindex $argv 0]
3 set password [lindex $argv 1]
4 set newpass [lindex $argv 2]
5 expect "Password:"
6 send "$password\r"
7 expect "Password:"
8 send "$newpass\r"
9 expect "Password:"
10 send "$newpass\r"
The problem is that on line 6 expect seems to send the password to stdout instead of sending it to the spawned process. The result I get is:
passwd: Authentication failure
I'm 100% sure the password I'm sending is correct. By the way, tried the same thing with su, and it worked fine, so it seems to be an issue with passwd only.
Has anybody came faced the same problem?
By the way, I'm on Suse linux, kernel 2.4.19...
Thanks,
William