DOAS.CONF(5)
π doas.conf β the config file that tells doas who's allowed to do what β¨
okay so bestie, welcome to the doas.conf manual page, aka the file-formats girlies' edition of the manual DOAS.CONF(5). pull up a chair, grab a boba, we're gonna read this whole thing together and it's gonna eat. π
πΈ NAME πΈ
doas.conf β the doas configuration file. that's it. that's the name. iconic.
π¦ DESCRIPTION π¦
so. the doas(1) utility runs commands as other users, right? and it decides who gets to run what based on the rules in the doas.conf configuration file. she's the boss. she's the gatekeeper. she's giving main character energy. π
the rules look like this:
permit|deny [options] identity [as target] [cmd command [args ...]]
and now let's break down every single part, no skips, no cap:
permit|denyβ the action to be taken if this rule matches. simple as that, girl.- options β the little extras. here's the full lineup:
nopassβ the user is not required to enter a password. no password prompt, we just vibe. πnologβ do not log successful command execution tosyslogd(8). keep it quiet, keep it mysterious.persistβ after the user successfully authenticates, do not ask for a password again for some time. bestie logged in once and now she's free. β¨keepenvβ environment variables other than those listed indoas(1)are retained when creating the environment for the new process. keep the vibes, keep the env. π«Άsetenv { [variable ...] [variable=value ...] }β keep or set the space-separated specified variables. variables may also be removed with a leading-or set using the latter syntax. if the first character of value is a$then the value to be set is taken from the existing environment variable of the indicated name. this option is processed after the default environment has been created. (yes that ordering matters, don't come for me.)
- identity β the username to match. groups may be specified by prepending a colon (
:). numeric IDs are also accepted. so like,:wheelis a whole group, slay. - as target β the target user the running user is allowed to run the command as. the default is all users. generous queen. π
- cmd command β the command the user is allowed or denied to run. the default is all commands. > be advised that it is best to specify absolute paths. if a relative path is specified, only a restricted
PATHwill be searched. (lowkey a trap, watch out.) - args [argument ...] β arguments to command. the command arguments provided by the user need to match those specified. the keyword
argsalone means that command must be run without any arguments. periodt.
okay so here's the big rule, the one that actually decides everything:
the last matching rule determines the action taken. and if no rule matches, the action is denied. π like, default is no. always no until proven yes.
comments can be put anywhere in the file using a hash mark (#), and extend to the end of the current line. go off, annotate your config, i support you.
and now, the quoting rules, which are very much giving β¨fine printβ¨:
- the text between a pair of double quotes (
") is taken as is. - the backslash character (
\) escapes the next character, including new line characters, outside comments; as a result, comments may not be extended over multiple lines. (so no, you cannot make a comment span lines. she said no. π«) - if quotes or backslashes are used in a word, it is not considered a keyword. iykyk.
π FILES π
/etc/doas.confβdoas(1)configuration file. the main girl./usr/share/doc/opendoas/examples/doas.confβ example configuration file. for when you need inspo. π
π₯ EXAMPLES π₯
okay here's the whole example, and it is so good, watch this. the following example:
- permits user
ajato install packages from a preferred mirror; - permits group
wheelto execute commands as any user while keeping the environment variablesPS1andSSH_AUTH_SOCKand unsettingENV; - permits
teduto runprocmapas root without a password; - and additionally permits
rootto run unrestricted commands as itself while retaining the originalPATH.
and here's the actual config, verbatim, copy it exactly bestie:
permit persist setenv { PKG_CACHE PKG_PATH } aja cmd pkg_add
permit setenv { -ENV PS1=$DOAS_PS1 SSH_AUTH_SOCK } :wheel
permit nopass tedu as root cmd /usr/sbin/procmap
permit nopass keepenv setenv { PATH } root as root
ate. no crumbs. π
π SEE ALSO π
doas(1), syslogd(8) β go read these too, they're the supporting cast and they understood the assignment.
β HISTORY β
the doas.conf configuration file first appeared in OpenBSD 5.8. a legend from day one, fr fr. π§
π AUTHORS π
Ted Unangst <tedu@openbsd.org> β the author, the icon, the moment. thank you for your service. π«‘
okay and finally, the cute little sign-off at the bottom: this is from the Debian crowd, dated October 9, 2020, and it's the DOAS.CONF(5) page. love that for us. stay slay, stay permitted, and remember β if no rule matches, you're denied. bye bestie!! πβ¨π¦πΈ
π¦ where this page comes from
- debian bookworm: opendoas 6.8.2-1+b1 Β· ISC
- debian trixie: opendoas 6.8.2-1+b1 Β· ISC
- ubuntu noble: opendoas 6.8.2-1 Β· ISC
- ubuntu questing: opendoas 6.8.2-1
- ubuntu resolute: opendoas 6.8.2-1build1 Β· ISC
- ubuntu stonking: opendoas 6.8.2-1build1 Β· ISC
- Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms