#root #admin #system #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

#88 in Windows APIs

Download history 465/week @ 2024-07-28 372/week @ 2024-08-04 417/week @ 2024-08-11 465/week @ 2024-08-18 395/week @ 2024-08-25 333/week @ 2024-09-01 301/week @ 2024-09-08 319/week @ 2024-09-15 394/week @ 2024-09-22 311/week @ 2024-09-29 353/week @ 2024-10-06 429/week @ 2024-10-13 488/week @ 2024-10-20 421/week @ 2024-10-27 457/week @ 2024-11-03 824/week @ 2024-11-10

2,216 downloads per month
Used in 6 crates (4 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