0

I need root privledges to do some stuff in my python script. I am currently using this technique

current_user = os.geteuid()

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

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?

2
Contributors
1
Reply
2
Views
11 Years
Discussion Span
Last Post by vegaseat
0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.