On 9/28/07, Robert Jackson <[EMAIL PROTECTED]> wrote:
>
> I'm trying to write a function that checks to see if the user that
> is running the python script is 'root' (I'm obviously running this
> Python program on Linux).


Why not just use os.geteuid() ?

import os

if os.geteuid() != 0:
  print "You must be root to run this script."
  sys.exit(1)
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to