[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Race conditions with passwd and expect or Comm.pl



Hi,

I'm working on the automated password changer, trying both the Comm.pl and
expect.  It looks like changing even the SimplePamApps source to get the 
password elsewhere means writing a new module, which I'm not yet prepared
for :)

In any case, it seems that when driven automatically, 'passwd' SOMETIMES
just echoes the entered password without taking it in.  It then has to be 
entered again.  I think the expect script has to watch out for its own
input, and use that as a cue to send the password again - I'm about to
try that.  In any case here's the expect script without the escape
hatch which I'm figuring out now.  Another potential pitfall is if
passwd complains about the new password.

spawn /usr/bin/telnet localhost
send ""
expect ogin:
send map\n
expect word:
send OldPassword\n
expect \]
send /usr/bin/passwd\n
expect word:
send OldPassword\n
expect word:
send NewPassword\n
expect :
send NewPassword\n
expect 
wait
exit


Regards,
-- 
miguel a.l. paraz  <map@iphil.net>                              +63-2-750-2288
iphil communications, makati city, philippines          <http://www.iphil.net> 













[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []