Change password on Linux

Mikael Gripenstedt mgi at fuckspam.openstrategy.se
Thu May 22 15:29:14 EDT 2003


On Thu, 22 May 2003 21:09:54 +0200, Bo M. Maryniuck wrote:

> On Thursday 22 May 2003 17:28, C42 wrote:
>> Does anyone know how to change a Linux password using Python?
> 
> 1. Tweak /etc/shadow if you're experienced Linux admin
> 2. os.popen() and passwd command

you could try something like this...

os.system("echo myuser | passwd mysecretpassword --stdin")

but you need to have root privileges to do this, so either execute it as
root or setup /etc/sudoers.

cheers,

 .MGI




More information about the Python-list mailing list