iamroot

Crates.ioiamroot
lib.rsiamroot
version0.2.0
created_at2025-07-11 01:48:15.698256+00
updated_at2025-07-11 02:37:11.029928+00
descriptionDisplay a message informing you whether this program is running as root or not
homepage
repositoryhttps://codeberg.org/RachaelAva1024/iamroot
max_upload_size
id1747285
size48,070
Rachael Ava (RachaelAva1024)

documentation

README

I Am Root

Display a message informing you whether this program is running as root or not


Rationale

One of the most convenient features of sudo and doas is the ability to have authenticated sudo/doas sessions persist for a short period of time before you have to enter your password again.

But there are some commands/scriptlets that may require you to already have an authenticated session open, otherwise, it may fail or behave irratically. Take this one-liner for example:

$ watch sudo btrfs filesystem usage /

This will present you with detailed information about the root BTRFS filesystem every few seconds, but for more information, you have to run the btrfs command as root. The problem arises when you do not have an authenticated session open already, and the password prompt appears, but due to the btrfs program being wrapped inside of the watch command, you're basically unable to enter in your password in time before watch runs the btrfs command again.

Cue I Am Root: Prepend the iamroot command in front of the watch command to open an authenticated session before the watch command and any programs wrapped inside is run.

$ sudo iamroot && watch sudo btrfs filesystem usage /

This will now ensure that an authenticated session is opened, but if not, don't continue to the watch command.

This is only but one of many different use-cases for I Am Root.

[!WARNING]

I Am Root is currently in beta. (That means bugs are to be expected!)


Copyright © 2025 Rachael Ava

Commit count: 0

cargo fmt