Execute a process as a specific user

Gerrit Holl gerrit at nl.linux.org
Fri Jun 13 11:00:48 EDT 2003


<quote name="Maurix" date="1055512403" email="maurix78_remove_this_ at wanadoo.es">
> A question for the unix users...
> How can i execute a process as a specific user from a process
> with root privileges?
> i'm doing this now with this command
> 
> os.system("su usuario -c comando")
> 
> Can i make this whitout the "su" command
</quote>

You can use os.setuid():

os.setuid(500)
os.system("comando")

yours,
Gerrit.

-- 
Mozilla _is_ the web: it grows faster than you can download it.
1011001 1101111 1110101 1110010 1110011 0101100
1000111 1100101 1110010 1110010 1101001 1110100





More information about the Python-list mailing list