Skip to content

Instantly share code, notes, and snippets.

@janaSunrise
Created November 8, 2025 08:12
Show Gist options
  • Save janaSunrise/0d029411735af981f361535994e82215 to your computer and use it in GitHub Desktop.
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.
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