944,068 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 3362
  • Python RSS
Jul 17th, 2005
0

changing to root user

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 17
Posting Whiz in Training
shanenin is offline Offline
217 posts
since May 2005
Jul 17th, 2005
0

Re: changing to root user

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.
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Tutorials
Next Thread in Python Forum Timeline: copy a file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC