#sudo #admin #root #system

archived is-root

A simple library to detect whether you are root/admin or not

3 releases

0.1.2 Aug 16, 2020
0.1.1 Aug 16, 2020
0.1.0 Aug 16, 2020

#449 in Unix APIs

Download history 1420/week @ 2023-02-18 2354/week @ 2023-02-25 1216/week @ 2023-03-04 1716/week @ 2023-03-11 1121/week @ 2023-03-18 984/week @ 2023-03-25 1111/week @ 2023-04-01 980/week @ 2023-04-08 1060/week @ 2023-04-15 1137/week @ 2023-04-22 1062/week @ 2023-04-29 756/week @ 2023-05-06 1088/week @ 2023-05-13 1071/week @ 2023-05-20 1322/week @ 2023-05-27 1791/week @ 2023-06-03

5,391 downloads per month
Used in 10 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

~52KB