On 5/31/2012 3:21 PM Dave said...
Hi. What is the right way to have an iPython script check to see if the
user is currently root?
Googling for "python check if user is root" yields the answer:
import os, sys
# if not root...kick out
if not os.geteuid()==0:
sys.exit("\nOnly root can run this script\n")
See
http://code.activestate.com/recipes/299410-root-access-required-to-run-a-script/
Emile
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor