Crate 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§

  • Cross platform representation of the state the current program running

Functions§

  • Check getuid() and geteuid() to learn about the configuration this program is running under
  • Restart your program with sudo if the user is not privileged enough.
  • Escalate privileges while maintaining RUST_BACKTRACE and selected environment variables (or none).