Skip to content
This repository was archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
Fix for the case where root is actually running the tool
Browse files Browse the repository at this point in the history
  • Loading branch information
chadsr committed Apr 22, 2019
1 parent 7bed3a5 commit 903cecf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nordnm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ def main():
print("%s must be run as root (unfortunately). Exiting." % __package__)
sys.exit(1)

# We are running with root priveledges, which is kinda scary, so lets switch to the original user until we actually need root
os.seteuid(int(os.getenv("SUDO_UID")))
# We are running with root priveledges, which is kinda scary, so lets switch to the original user until we actually need root (if there is one)
user_uid = os.getenv("SUDO_UID")
if user_uid:
os.seteuid(int(user_uid))

# Add our custom logging formatter function to handle all logging output
formatter = utils.LoggingFormatter()
Expand Down

0 comments on commit 903cecf

Please sign in to comment.