[mod_python] Re: running as root...

Jorge Godoy godoy at ieee.org
Sun Apr 4 20:25:55 EST 2004

On Dom 04 Abr 2004 19:11, Eric Walstad wrote:

> I need to give one of my mod_python apps the ability to run as root.
> Aside from the security risks, what's the best to do this?  Nothing
> much came up on google when I checked.

Eric, unless your webserver run as root I'm afraid it won't be possible.

An alternative would be to evaluate exactly what will require root powers
and use a C wrapper to run another Python script or tool with such

Here's one example from the Perl documentation:

           #define REAL_PATH "/path/to/script"
           main(ac, av)
               char **av;
               execv(REAL_PATH, av);

Here, "/path/to/script" would be either the path to the binary or to your
other Python script. It will pass along all the parameters it gets in
command line, so the result would be the same as if you ran your
script/program as root.

Be seeing you,
Godoy.      <godoy at ieee.org>

More information about the Mod_python mailing list