[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[seul-edu] A question you posted
You had a question about using expect with passwd way back in april.
I stumbled accross it and reading the thread it looked like noone ever
gave you the solution. Im sure this is probably too late, but for the
sake of satisfying curiosity here is one possible solution.
Taken from the expect FAQ:
64.Why does Expect sometimes misbehave when automating passwd on RedHat
This is a two-part question.
1.Expect sometimes hangs.
RedHat passwd has a bug. It prompts before it is ready to
receive input. Humans are slow (relatively speaking) so this normally
isn't noticeable. Alas, Expect is
fast enough that by the time passwd is ready, Expect has
already sent the password. So passwd sits and waits and Expect sits and
waits. It appears hung.
A simple workaround: Briefly pause before sending the
password. A tenth of a second is probably sufficient but of course since
the passwd program makes no
guarantees, I can't either.
2.Expect sometimes seems really slow.
This is really the same bug as above, except that you
haven't explicitly specified a timeout. Expect uses its default of 10
seconds, meaning that it stops waiting
after 10 seconds and resends the password (presuming you are
looping to send the password as long as /bin/passwd keeps asking). After
/bin/passwd is highly likely to finally be listening. So
/bin/passwd tells Expect it is now happy and Expect finishes.
Could someone get RedHat to fix this bug?
If it sounds too good to be true, its probably Linux.
Linux -- The choice of a GNU generation.
Bryan McClendon <firstname.lastname@example.org>