Skip to main content

is_elevated

Function is_elevated 

Source
pub fn is_elevated() -> Result<bool>
Expand description

Whether this process runs as root, or with an elevated Administrator token.

This is a check, not a control: privilege drops belong to shield-sec, which calls this afterwards to verify.

if sys_lib::process::is_elevated()? {
    // refuse to serve requests until privileges are dropped
}

ยงErrors

Os when the token cannot be queried (Windows).