#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

#93 in Windows APIs

Download history 457/week @ 2024-10-16 410/week @ 2024-10-23 452/week @ 2024-10-30 508/week @ 2024-11-06 947/week @ 2024-11-13 1132/week @ 2024-11-20 432/week @ 2024-11-27 194/week @ 2024-12-04 278/week @ 2024-12-11 314/week @ 2024-12-18 29/week @ 2024-12-25 132/week @ 2025-01-01 178/week @ 2025-01-08 151/week @ 2025-01-15 348/week @ 2025-01-22 127/week @ 2025-01-29

833 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

~81–295KB