Created
November 8, 2025 08:12
-
-
Save janaSunrise/0d029411735af981f361535994e82215 to your computer and use it in GitHub Desktop.
Check if the current program is running as root user. `euid` is the effective user ID of the current process. The `euid` for the root user is 0.
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 check_sudo(): | |
| return os.geteuid() == 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment