0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-19 09:51:19 +02:00

Change detecting sudo priviliges to check if process euid is 0

This commit is contained in:
Devin Lin 2020-10-12 11:35:59 -04:00
parent 3c9537a35f
commit 1b1b1d2b5e

View file

@ -80,7 +80,7 @@ builtins.howdy_user = args.user
# Check if we have rootish rights # Check if we have rootish rights
# This is this far down the file so running the command for help is always possible # This is this far down the file so running the command for help is always possible
if os.getenv("SUDO_USER") is None: if not os.geteuid()==0:
print("Please run this command as root:\n") print("Please run this command as root:\n")
print("\tsudo howdy " + " ".join(sys.argv[1:])) print("\tsudo howdy " + " ".join(sys.argv[1:]))
sys.exit(1) sys.exit(1)