Crate unix_is_elevated

Crate unix_is_elevated 

Source
Expand description

Check whether the running process has elevated privileges, under Unix.

The is_elevated function uses:

  • getauxval(AT_SECURE) on Linux, if available,
  • issetugid() on MacOS and *BSD,
  • getuid() != geteuid() || getgid() != getegid() as fallback.

Functionsยง

is_elevated
is_root
Returns whether the process is running as root (uid 0).