root password in a .py script

Ben Finney bignose-hates-spam at
Sat Mar 13 04:50:35 CET 2004

On 12 Mar 2004 20:04:10 -0800, Paul Rubin wrote:
> Rather than entering the plaintext password through the passwd
> command, your best bet is for your script to edit /etc/passwd or
> /etc/shadow and replace the new hashed password with the correct one.

No, that makes the increasingly incorrect assumption that the passwords
are stored and accessed via those files.  Many systems use NIS or LDAP
or other protocol-based account table management methods, and the
'passwd' command is often set up to use that method.  Affecting /etc/*
files in such a case would have no effect on the root password.

 \       "I bought some batteries, but they weren't included; so I had |
  `\                             to buy them again."  -- Steven Wright |
_o__)                                                                  |
Ben Finney <>

More information about the Python-list mailing list