#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

#134 in Windows APIs

Download history 1118/week @ 2024-11-15 729/week @ 2024-11-22 361/week @ 2024-11-29 209/week @ 2024-12-06 287/week @ 2024-12-13 223/week @ 2024-12-20 45/week @ 2024-12-27 200/week @ 2025-01-03 153/week @ 2025-01-10 131/week @ 2025-01-17 372/week @ 2025-01-24 247/week @ 2025-01-31 216/week @ 2025-02-07 233/week @ 2025-02-14 761/week @ 2025-02-21 253/week @ 2025-02-28

1,506 downloads per month
Used in 8 crates (5 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