Root access with python
Aahz
aahz at pythoncraft.com
Mon Mar 25 09:58:17 EST 2002
In article <7x663krjtp.fsf at ruckus.brouhaha.com>,
Paul Rubin <phr-n2002a at nightsong.com> wrote:
>mtaylor at lowebroadway.com (Moray Taylor) writes:
>>
>> I want to know how to run a 'root' command with python, i.e. mounting
>> an NFS drive.
>>
>> On the terminal, you would do a 'su', type your password, then enter
>> the command you wanted to run. How is this achieved within Python?
>>
>> My purpose is to make a small GUI app with PyQT to make mounting NFS
>> volumes easier, I can handle the GUI bit, but I don't understand how
>> to 'su'.
>
>Don't try to do that unless you REALLY know what you're doing with
>security implementation.
>
>Instead, run "su" the usual way and type your password to get a root
>shell, then launch your GUI app from the root shell.
Good advice. Nevertheless, if Moray wants to shoot zirself in the foot,
zie should take a look at os.setuid().
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"We should forget about small efficiencies, about 97% of the time.
Premature optimization is the root of all evil." --Knuth
More information about the Python-list
mailing list