Execute a process as a specific user
Peter Hansen
peter at engcorp.com
Fri Jun 13 11:25:44 EDT 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:
http://www.python.org/doc/current/lib/os-procinfo.html
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.
-Peter
More information about the Python-list
mailing list