473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

problem with PIPE

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
2 3082
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Doug | last post by:
This works with a small string, but not a large one (read returns an empty string if i pass a large html file to tidy): >>> iin , iiout = popen2("tidy.exe -asxml") >>> iin.write(str) >>>...
2
by: Gandalf | last post by:
Hi All! I don't know if this is a Python problem or not. Here is a snippet: import os TERM='\n\r\n\r' cmd = 'cu -l /dev/cuaa0 -s9600' pop = os.popen4(cmd,1) pop.write('AT'+TERM) # Ping modem
5
by: richard | last post by:
I have a simple test to pass information from a client to a server using named pipe. what I really want is: when I type a line on the client, the server will output the line immediately. but to my...
1
by: Lewap | last post by:
Hi! I have a problem: Function CreateNamedPipe (a piece of source below) called in a NT service I get an error 997 - Overlapped I/O operation is in progress. When I run the same code as...
2
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the...
1
by: Jon | last post by:
Hi there. I'm trying to create a query (or two) that I can use to produce a spreadsheet but I'm having a bit of trouble. I'm using Access 2000. My db is set up like this: Table1: Intrusive...
2
by: Jwhal | last post by:
I'm having trouble querying one table with multiple entries. I'm not sure if or what kind of joins I need to do this, or if it should be a make table followed by an append, then an update, or what....
7
by: Greg | last post by:
I am trying to implement the UNIX pipe command using C but with the "->" operator. Everything works fine with 1 pipe, but when I try to use 2 or more, it hangs up when reading the pipe_in...
0
by: Stewart Midwinter | last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.