#root #system #admin #sudo

is-root

A simple library to detect whether you are root/admin or not

4 releases

0.1.3 Aug 4, 2023
0.1.2 Aug 16, 2020
0.1.1 Aug 16, 2020
0.1.0 Aug 16, 2020

#46 in Windows APIs

Download history 473/week @ 2024-03-13 370/week @ 2024-03-20 327/week @ 2024-03-27 411/week @ 2024-04-03 610/week @ 2024-04-10 593/week @ 2024-04-17 502/week @ 2024-04-24 587/week @ 2024-05-01 420/week @ 2024-05-08 405/week @ 2024-05-15 255/week @ 2024-05-22 304/week @ 2024-05-29 285/week @ 2024-06-05 409/week @ 2024-06-12 468/week @ 2024-06-19 358/week @ 2024-06-26

1,553 downloads per month
Used in 5 crates (3 directly)

MIT license

5KB

is-root

Downloads License crates.io docs.rs Gitlab CI

A simple library to detect whether you are root/admin or not

Installation

Add is-root = "0.1.2" to [dependencies] section in your Cargo.toml

Usage

use is_root::is_root;

if is_root() {
    println!("Doing something dangerous")
} else {
    eprintln!("Run me as root")
}

You can find examples in examples directory


lib.rs:

A simple library to detect whether you are root/admin or not

Usage

use is_root::is_root;

if is_root() {
    println!("Doing something dangerous")
} else {
    eprintln!("Run me as root")
}

Dependencies

~80–295KB