Expand description
§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,
};
// 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));
// 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));
§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.
Structs§
- Fakeroot
Backend - A rootless backend for running commands using fakeroot.
- Fakeroot
Options - Options for fakeroot.
- Rootlesskit
Backend - A rootless backend for running commands using rootlesskit.
- Rootlesskit
Options - Options for rootlesskit.
Enums§
- Auto
Option - An option that may be on, off or automatic.
- Confidential
Virtualization Technology - A confidential virtualization technology detected by systemd-detect-virt.
- Copy
UpMode - The mode used for rootlesskit’s
--copy-up
option. - Error
- An error that can occur when using a rootless backend.
- Net
- A network driver used by rootlesskit.
- Port
Driver - A port driver for the non-host network of rootlesskit.
- Propagation
- The propagation used for rootlesskit’s
--copy-up
option. - SubId
Source - The source of subids for rootlesskit.
- Systemd
Detect Virt Container - A container environment detected by systemd-detect-virt.
- Systemd
Detect Virt Output - The output of systemd-detect-virt.
- Systemd
Detect Virt Vm - A VM environment detected by systemd-detect-virt.
Traits§
- Rootless
Backend - A backend for running a command as root.
- Rootless
Options - The options for a rootless backend.
Functions§
- detect_
virt - Detects whether currently running in a virtualized or containerized Linux environment.
- get_
command - Returns the path to a
command
.