rootless-run

Crates.iorootless-run
lib.rsrootless-run
version0.1.0
created_at2025-08-27 08:24:45.53531+00
updated_at2025-08-27 08:24:45.53531+00
descriptionRootless execution of commands that require root
homepage
repositoryhttps://gitlab.archlinux.org/dvzrv/rootless-run
max_upload_size
id1812309
size191,859
Orhun Parmaksız (orhun)

documentation

README

rootless-run 🫚🚫🏃‍➡️

A Rust library for the execution of commands as root without being root.

Currently, it supports fakeroot and rootlesskit.

Documentation

Refer to https://docs.rs/rootless-run/latest/rootless_run/ for released versions of the crate.

Examples

Library

use rootless_run::{
    FakerootBackend,
    FakerootOptions,
    RootlessBackend,
    RootlesskitBackend,
    RootlesskitOptions,
};
# use rootless_run::detect_virt;

# fn main() -> testresult::TestResult {
// Create a fakeroot backend with default options.
let backend = FakerootBackend::new(FakerootOptions::default());

// Call `whoami` using fakeroot and return its output.
let output = backend.run(&["whoami"])?;

assert_eq!("root\n", String::from_utf8_lossy(&output.stdout));

# let virt = detect_virt()?;
# if !virt.uses_namespaces() {
// Create a rootlesskit backend with default options.
let backend = RootlesskitBackend::new(RootlesskitOptions::default());

// Call `whoami` using rootlesskit and return its output.
let output = backend.run(&["whoami"])?;

assert_eq!("root\n", String::from_utf8_lossy(&output.stdout));
# }
# Ok(())
# }

Contributing

Please refer to the contribution guidelines to learn how to contribute to this project.

Releases

Releases are created by the developers of this project.

OpenPGP certificates with the following OpenPGP fingerprints can be used to verify signed tags:

Some of the above are part of archlinux-keyring and certified by at least three main signing keys of the distribution. All certificate are cross-signed and can be retrieved from OpenPGP keyservers.

License

This project can be used under the terms of the Apache-2.0 or MIT. Contributions to this project, unless noted otherwise, are automatically licensed under the terms of both of those licenses.

Commit count: 0

cargo fmt