[mod_python] Re: running script with the permissions of the authenticated system user

Haim Ashkenazi haim at babysnakes.org
Fri Sep 10 04:21:23 EDT 2004


On Fri, 10 Sep 2004 10:07:06 +1000, Byron Ellacott wrote:

> Haim Ashkenazi wrote:
>> 2. the script must run as the user authenticated. I can make it run as
>> root and run system commands with 'su' but I was wondering is there a
>> module in python to handle it.
> 
> On UNIX systems, sys.os.set[e]uid() will allow you to set the 
> (effective) user ID for the process.  If your script is running as root 
> initially, you should probably use sys.os.setuid() as soon as you know 
> the user you need to be.  If your script might be handling several 
> requests, you'll probably need to use seteuid() instead, and revert to 
> root when you're done.
great, that's what I was looking for. to revert to root do I use seteuid()
again?

tnanx
-- 
Haim




More information about the Mod_python mailing list