root password in a .py script

Paul Rubin http
Fri Mar 12 23:04:10 EST 2004


Bart Nessux <bart_nessux at hotmail.com> writes:
> How else could I twist this up?

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.
Note that the hashed password is always the same length and should
always be in the same location (on the first line) of the file, so you
should be able to just overwrite it in place.



More information about the Python-list mailing list