Skip to main content

escalate_if_needed

Function escalate_if_needed 

Source
pub fn escalate_if_needed() -> Result<RunningAs, Box<dyn Error>>
Expand description

Restart your program with sudo if the user is not privileged enough.

Activates SUID privileges when available

sudo::escalate_if_needed()?;
// the following gets only executed in privileged mode