Created
November 1, 2015 00:04
-
-
Save cgoldberg/eb434a34fc5fda4dbcef to your computer and use it in GitHub Desktop.
check if the process is running as root (Unix/Linux)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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