Dhika Cikul schrieb: > Hello, > > I'm new in Python, i don't know my subject is correct or wrong. I have > problem with my script. I want to change password with passwd password > in python without user submitted anything from keyboard. I get > tutorial that i must use pipe to process this. And this is my code : > > [code] > > 1. > 2. #!/usr/bin/python > 3. > 4. import os > 5. > 6. COMMAND = 'passwd' > 7. PASSWD = 'mypassword' > 8. > 9. # open a pipe to passwd program and > 10. # write the data to the pipe > 11. p = os.popen("%s" % COMMAND, 'w') > 12. p.write(PASSWD) > 13. p.write('\n') > 14. p.write(PASSWD) > 15. p.close() > 16. > [/code] > > > but i got this error : > > [output] > [EMAIL PROTECTED] cp]$ ./password > Changing password for user cp. > Changing password for cp > (current) UNIX password: passwd: Authentication token manipulation error > [/output] > > Anyone can help me how to write to pipe.. i try several method, and > always fail. > > Thank's
I guess the passwd program doesn't allow changing passwords from a pipe since it is a potential security hole. -- http://mail.python.org/mailman/listinfo/python-list