Thanks. I like the integer-based option. Since this is my first question to the list, is it appropriate to reply with a "thanks, that solved it" or is that considered unnecessary?
On Thu, May 31, 2012 at 6:30 PM, Emile van Sebille <em...@fenx.com> wrote: > 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/<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<http://mail.python.org/mailman/listinfo/tutor> >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor