Expand description
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.
- It should work on *BSD. However, you can also create an Escalate
builder with
Structs§
Enums§
- Running
As - Cross platform representation of the state the current program running
Functions§
- builder
- Alias for Escalate::builder() to quickly create a new sudo Escalate builder
- 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.
- escalate_
with_ env - Restart your program with sudo and if the user is not privileged enough. Inherit all environment variables.
- pkexec
- Similar to escalate_if_needed, but with pkexec as the wrapper
- running_
as_ root - Returns
true
if binary is already running as root. - running_
as_ suid - Returns
true
if binary is already running as suid. - with_
env - Escalate privileges while maintaining RUST_BACKTRACE and selected environment variables (or none).
- with_
env_ wildcards - Escalate privileges while maintaining RUST_BACKTRACE and selected environment variables that matches given wildcard (or none).