RSS Forums RSS
Please support our Python advertiser: Programming Forums
Views: 2074 | Replies: 1
Reply
Join Date: May 2005
Posts: 215
Reputation: shanenin is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
shanenin shanenin is offline Offline
Posting Whiz in Training

changing to root user

  #1  
Jul 17th, 2005
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?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2004
Posts: 2,548
Reputation: vegaseat will become famous soon enough vegaseat will become famous soon enough 
Rep Power: 11
Solved Threads: 178
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Solution Re: changing to root user

  #2  
Jul 17th, 2005
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.
May 'the Google' be with you!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:31 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC