Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]RE: [tlug] executing a command that requires root from a python script
- Date: Tue, 07 Aug 2007 02:27:30 +0000
- From: "Mike J" <astro_mikel@example.com>
- Subject: RE: [tlug] executing a command that requires root from a python script
Doesn't really help but it sounds like something SSH keys could do.....
Cheers,
michael.
From: "Hector Akamine" <akamine@example.com> Reply-To: Tokyo Linux Users Group <tlug@example.com> To: "Tokyo Linux Users Group" <tlug@example.com> Subject: [tlug] executing a command that requires root from a python script Date: Tue, 7 Aug 2007 10:51:28 +0900
Hi,
I would like to execute a command that requires root privileges from a
python script, for example something like "su -l -c ifconfig"
(I don't want my entire python script running with root privileges).
I can execute the command using subprocess.Popen(), but I am required to enter
the root password with the keyboard. I would like the python script
to enter the password
I have tried to do something like keyb = StringIO.StringIO() keyb.write('rootpass\n') subproc = subprocess.Popen(["su","-l","-c","ifconfig"], stdin=keyb)
to try to create a file-like object and feed it as stdin to the subprocess, but it doesn't work (got an error)
Is it possible to do this?
Thanks,
Hector
-- To unsubscribe from this mailing list, please see the instructions at http://www.tlug.jp/list.html
Please visit our sponsor at http://www.primustel.co.jp/tlug/
_________________________________________________________________
Advertisement: Telstras Next GTM Network - now on Pre-Paid. Find out more. www.spreadthegoodstuff.com.au http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fclk%2Eatdmt%2Ecom%2FOAT%2Fgo%2Fnnmsnnxg0080000046oat%2Fdirect%2F01%2F&_t=765565283&_r=Telstra_FFF_Prepaid_Hotmail_Email_Taglines_JuySep07_Aug&_m=EXT
- References:
- [tlug] executing a command that requires root from a python script
- From: Hector Akamine
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Emergency nomikai August 17th?
- Next by Date: Re: [tlug] How to use FF's shortcuts
- Previous by thread: Re: [tlug] executing a command that requires root from a python script
- Next by thread: [tlug] RE: [OT] A Wiki Question
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links