#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

#44 in Windows APIs

Download history 283/week @ 2024-01-08 297/week @ 2024-01-15 263/week @ 2024-01-22 257/week @ 2024-01-29 288/week @ 2024-02-05 227/week @ 2024-02-12 295/week @ 2024-02-19 371/week @ 2024-02-26 477/week @ 2024-03-04 647/week @ 2024-03-11 401/week @ 2024-03-18 283/week @ 2024-03-25 397/week @ 2024-04-01 541/week @ 2024-04-08 591/week @ 2024-04-15 471/week @ 2024-04-22

2,036 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