Crate is_sudo

Source
Expand description

crates.io docs.rs

Detect if you are running as root, restart self with sudo if needed or setup uid zero when running with the SUID flag set.

§Requirements

  • The sudo program is required to be installed and setup correctly on the target system.
  • Linux or Mac OS X tested
    • It should work on *BSD. However, it is not tested.

Enums§

RunningAs
Cross platform representation of the state the current program running

Functions§

check
This checks whether the current process is running as sudo or not. Returns the RunningAs enum as result