1 unstable release
Uses new Rust 2024
| 0.1.0 | Aug 27, 2025 |
|---|
#1441 in Unix APIs
82KB
1.5K
SLoC
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:
991F6E3F0765CF6295888586139B09DA5BF0D338(David Runge <dvzrv@archlinux.org>)165E0FF7C48C226E1EC363A7F83424824B3E4B90(Orhun Parmaksız <orhun@archlinux.org>)
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.
Dependencies
~280–740KB
~16K SLoC