954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

changing to root user

I need root privledges to do some stuff in my python script. I am currently using this technique
[php]
current_user = os.geteuid()

if current_user != 0:
print "you need to be root to run this script"
sys.exit()[/php]

this will at least polietly end the script so i am able to log in as root. then start the script as root user.

Is it a very involved process to have the script prompt me for my root password and switch users?

shanenin
Posting Whiz in Training
217 posts since May 2005
Reputation Points: 10
Solved Threads: 17
 

Where there is a geteuid(), there is seteuid(userid_data). Unfortunately I can't play with it, since I don't have a Unix machine.

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You