Crates.io | rootless-run |
lib.rs | rootless-run |
version | 0.1.0 |
created_at | 2025-08-27 08:24:45.53531+00 |
updated_at | 2025-08-27 08:24:45.53531+00 |
description | Rootless execution of commands that require root |
homepage | |
repository | https://gitlab.archlinux.org/dvzrv/rootless-run |
max_upload_size | |
id | 1812309 |
size | 191,859 |
A Rust library for the execution of commands as root without being root.
Currently, it supports fakeroot and rootlesskit.
Refer to https://docs.rs/rootless-run/latest/rootless_run/ for released versions of the crate.
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(())
# }
Please refer to the contribution guidelines to learn how to contribute to this project.
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.
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.