By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,002 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,002 IT Pros & Developers. It's quick & easy.

problem with PIPE

P: n/a
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 :

Expand|Select|Wrap|Line Numbers
  1.  
  2. 1.
  3. 2. #!/usr/bin/python
  4. 3.
  5. 4. import os
  6. 5.
  7. 6. COMMAND = 'passwd'
  8. 7. PASSWD  = 'mypassword'
  9. 8.
  10. 9. # open a pipe to passwd program and
  11. 10. # write the data to the pipe
  12. 11. p = os.popen("%s" % COMMAND, 'w')
  13. 12. p.write(PASSWD)
  14. 13. p.write('\n')
  15. 14. p.write(PASSWD)
  16. 15. p.close()
  17. 16.
  18.  

but i got this error :

[output]
[cp@server 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
--
Dhika Cikul
Dec 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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 :

Expand|Select|Wrap|Line Numbers
  1.   1.
  2.   2. #!/usr/bin/python
  3.   3.
  4.   4. import os
  5.   5.
  6.   6. COMMAND = 'passwd'
  7.   7. PASSWD  = 'mypassword'
  8.   8.
  9.   9. # open a pipe to passwd program and
  10.  10. # write the data to the pipe
  11.  11. p = os.popen("%s" % COMMAND, 'w')
  12.  12. p.write(PASSWD)
  13.  13. p.write('\n')
  14.  14. p.write(PASSWD)
  15.  15. p.close()
  16.  16.
  17.  


but i got this error :

[output]
[cp@server 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.
Dec 24 '06 #2

P: n/a
In article <em**********@registered.motzarella.org>,
Felix Benner <fe**********@imail.dewrote:
>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
Dec 24 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.