Skip to content

Instantly share code, notes, and snippets.

@cgoldberg
Created November 1, 2015 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cgoldberg/eb434a34fc5fda4dbcef to your computer and use it in GitHub Desktop.
Save cgoldberg/eb434a34fc5fda4dbcef to your computer and use it in GitHub Desktop.
check if the process is running as root (Unix/Linux)
import os
def got_root():
"""check if we are running as root."""
if os.geteuid() == 0:
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment