doas
A Rust implementation of doas, an alternative to sudo for running commands as other users.
Features
- Simple configuration file syntax
- Supports permit/deny rules with options like nopass, keepenv
- PAM authentication
- Unix-like systems only
Installation
-
Build the project:
-
Install the binary:
-
Create config file:
-
Edit the config file to add rules, e.g.:
permit yourusername as root
Usage
Configuration
The config file is located at /etc/doas.conf or /usr/local/etc/doas.conf.
Syntax:
permit [nopass] [keepenv] [nolog] identity as target
permitordenynopass: no password requiredkeepenv: keep environment variablesnolog: don't logidentity: the user who can runtarget: the user to run as
Security
The binary must be setuid root to function properly. Ensure the config file is only readable by root.