Execute a process as a specific user

Peter Hansen peter at engcorp.com
Fri Jun 13 17:25:44 CEST 2003

Maurix wrote:
> How can i execute a process as a specific user from a process
> with root privileges?

See the various routines under the "os" module: 

You would want things like setuid() and/or seteuid().  

> i'm doing this now with this command
> os.system("su usuario -c comando")
> Can i make this whitout the "su" command

Sure!  Log in as root, then run the script.


More information about the Python-list mailing list