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



On Tuesday 07 August 2007 11:28:55 Simon Cozens wrote:
> Hector Akamine wrote:
> > 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).
>
> Can you use sudo instead? That's the sort of thing it was designed for.

I second Simon's suggestion for using sudo.  Simply add a line in your sudo 
configuration file that specifies that no password is required to run the 
command that you need root privileges for.  You can enable it for a single 
user, a group of users, or all users, depending on what is needed.

Here is a useful reference:
http://gentoo-wiki.com/Sudo_config

Cheers,

Travis


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links