Crate karen

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, you can also create an Escalate builder with doas as the wrapper should you prefer that.

Structs§

Escalate

Enums§

RunningAs
Cross platform representation of the state the current program running

Functions§

builder
Alias for Escalate::builder() to quickly create a new karen Escalate builder
check
Check getuid() and geteuid() to learn about the configuration this program is running under
doas
Similar to escalate_if_needed, but with doas as the wrapper
escalate_if_needed
Restart your program with sudo if the user is not privileged enough.
pkexec
Similar to escalate_if_needed, but with pkexec as the wrapper
with_env
Escalate privileges while maintaining RUST_BACKTRACE and selected environment variables (or none).