#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

#77 in Windows APIs

Download history 502/week @ 2024-06-17 447/week @ 2024-06-24 325/week @ 2024-07-01 603/week @ 2024-07-08 488/week @ 2024-07-15 423/week @ 2024-07-22 475/week @ 2024-07-29 383/week @ 2024-08-05 405/week @ 2024-08-12 479/week @ 2024-08-19 377/week @ 2024-08-26 337/week @ 2024-09-02 306/week @ 2024-09-09 314/week @ 2024-09-16 384/week @ 2024-09-23 330/week @ 2024-09-30

1,366 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