473,587 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3104
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**********@r egistered.motza rella.org>,
Felix Benner <fe**********@i mail.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
1898
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) >>> iin.close() >>> iiout.read() ''
2
3915
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
17410
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 surprise, I always have to terminate the client to get the server in action, i.e. prints out what I typed. anything I missed? I am compiling...
1
2830
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 oridinal application (not NT service) everything works properly. Service is develop in Managed/Unmanaged C++ (.NET Environment). And is
2
4540
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 the function due to its
1
359
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 Manhole Survey Fields: IntrusiveEntryID (PK), ManholeID, Date, Sewer System, Firm, Inspector, Benching Description, Manhole Type, Manhole Diameter, Sump...
2
301
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. I have four of these db's to work with. This is the smallest db I have. The largest contains about 260 manholes, and over 500 pipes. Here are my...
7
3697
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 filestream. If ANYONE could offer ANY suggestion as to why this is happening it would be much appreciated. Thanks in advance!
0
2344
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 widget, but for some reason the text is invisible on cygwin). After I close the Toplevel widget, all of the menus in my app behave as though they...
0
8215
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8347
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6626
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.