[Tutor] Python script to change a password in linux
Mehmet Yousouf
mehmety at carramar.auslin.com.au
Fri Nov 19 08:53:08 CET 2004
Hi, I've been trying to write some functions to
administer users on
our "mailserver" at home (an interesting way to
learn python and
zope...)
I have the functions for adding and deleting
users, however, I can't
get the function for changing a password to work
the way I want (I
can write to a file "userid:password" strings and
run a cron job to
update the passwords using chpasswd which would no
doubt be safer,
but.....)
Can someone tell me why this line does not work?
def userChangePass(userid, password)
import os
import sys
os.system('echo %s:%s | sudo
/usr/sbin/chpasswd -p' % (userid,
password) )
Regards, Mehmet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20041119/6c5f1373/attachment.html
More information about the Tutor
mailing list