By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,923 Members | 1,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,923 IT Pros & Developers. It's quick & easy.

switch user

P: n/a
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

Oct 3 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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
s9************@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
Oct 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.