switch user

Nick Vatamaniuc vatamane at gmail.com
Tue Oct 3 03:12:05 EDT 2006


Check out the os module, especially the
os.getgid(),
os.getuid(),
os.setgid(),
os.getuid(),
methods. There are more , take at a look at Python documentation.

You can start a script as root then change your priveleges with
os.setgid() os.setuid() methods. Note: those methods operate with
integer user and group IDs, not with user and group names.

Hope that helps,
-Nick Vatamaniuc


s99999999s2003 at yahoo.com wrote:
> hi
>
> due to certain constraints, i will running a python script as root
> inside this script, also due to some constraints, i need to switch user
> to user1 to run the 
> rest of the script...is there a way ?thanks




More information about the Python-list mailing list