Bug 9917 - autopasswd doesn't work at all
Summary: autopasswd doesn't work at all
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: tcltk
Version: 6.1
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Jens Petersen
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-03-02 11:06 UTC by Geoffrey D. Bennett
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-01-16 07:48:34 UTC

Attachments (Terms of Use)

Description Geoffrey D. Bennett 2000-03-02 11:06:17 UTC
The autopasswd script included with tcl/tk doesn't work at all because it
sends the password before passwd starts listening for a password.  This
results in the script just hanging.

Even if it did work, certain passwords (eg. those beginning with a hyphen)
cannot be set because the password is interpreted as an option to "send".

The replacement script below fixes both of the above problems.  I don't
know if the 0.1s sleep is sufficient in all cases, but I've not had it fail
for me yet.

#!/usr/bin/expect --
# wrapper to make passwd(1) be non-interactive
# username is passed as 1st arg, passwd as 2nd

set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
expect "password:"
sleep 0.1
send -- "$password\r"
expect "password:"
sleep 0.1
send -- "$password\r"
expect eof

Comment 1 Jeff Johnson 2000-03-18 20:58:59 UTC
*** This bug has been marked as a duplicate of 4768 ***

Comment 2 Geoffrey D. Bennett 2002-10-16 12:38:10 UTC
I don't think this bug is resolved.  Bug 4768 has nothing to do with autopasswd.
 Although the timing issue seems to have gone away in later releases of RHL, the
problem with not being able to put in passwords beginning with hyphens is still

Comment 3 Jens Petersen 2002-12-10 06:24:11 UTC
Should be fixed in expect-5.38.0-76.

Comment 4 Jens Petersen 2003-01-16 07:48:34 UTC
Closing for now.  Please re-open if there are still problems.

Note You need to log in before you can comment on or make changes to this bug.