1DOAS.CONF(5)                BSD File Formats Manual               DOAS.CONF(5)
2

NAME

4     doas.conf — doas configuration file
5

DESCRIPTION

7     The doas(1) utility executes commands as other users according to the
8     rules in the doas.conf configuration file.
9
10     The rules have the following format:
11
12           permit|deny [options] identity [as target] [cmd command [args ...]]
13
14     Rules consist of the following parts:
15
16     permit|deny  The action to be taken if this rule matches.
17
18     options      Options are:
19
20                  nopass   The user is not required to enter a password.
21
22                  nolog    Do not log successful command execution to
23                           syslogd(8).
24
25                  persist  After the user successfully authenticates, do not
26                           ask for a password again for some time.
27
28                  keepenv  Environment variables other than those listed in
29                           doas(1) are retained when creating the environment
30                           for the new process.
31
32                  setenv { [variable ...] [variable=value ...] }
33                           Keep or set the space-separated specified vari‐
34                           ables.  Variables may also be removed with a lead‐
35                           ing ‘-’ or set using the latter syntax.  If the
36                           first character of value is a ‘$’ then the value to
37                           be set is taken from the existing environment vari‐
38                           able of the indicated name.  This option is pro‐
39                           cessed after the default environment has been cre‐
40                           ated.
41
42     identity     The username to match.  Groups may be specified by prepend‐
43                  ing a colon (‘:’).  Numeric IDs are also accepted.
44
45     as target    The target user the running user is allowed to run the com‐
46                  mand as.  The default is all users.
47
48     cmd command  The command the user is allowed or denied to run.  The
49                  default is all commands.  Be advised that it is best to
50                  specify absolute paths.  If a relative path is specified,
51                  only a restricted PATH will be searched.
52
53     args [argument ...]
54                  Arguments to command.  The command arguments provided by the
55                  user need to match those specified.  The keyword args alone
56                  means that command must be run without any arguments.
57
58     The last matching rule determines the action taken.  If no rule matches,
59     the action is denied.
60
61     Comments can be put anywhere in the file using a hash mark (‘#’), and
62     extend to the end of the current line.
63
64     The following quoting rules apply:
65
66     -   The text between a pair of double quotes (‘"’) is taken as is.
67
68     -   The backslash character (‘\’) escapes the next character, including
69         new line characters, outside comments; as a result, comments may not
70         be extended over multiple lines.
71
72     -   If quotes or backslashes are used in a word, it is not considered a
73         keyword.
74

FILES

76     /etc/doas.conf           doas(1) configuration file.
77     /etc/examples/doas.conf  Example configuration file.
78

EXAMPLES

80     The following example permits user aja to install packages from a pre‐
81     ferred mirror; group wheel to execute commands as any user while keeping
82     the environment variables PS1 and SSH_AUTH_SOCK and unsetting ENV; per‐
83     mits tedu to run procmap as root without a password; and additionally
84     permits root to run unrestricted commands as itself while retaining the
85     original PATH.
86
87           permit persist setenv { PKG_CACHE PKG_PATH } aja cmd pkg_add
88           permit setenv { -ENV PS1=$DOAS_PS1 SSH_AUTH_SOCK } :wheel
89           permit nopass tedu as root cmd /usr/sbin/procmap
90           permit nopass keepenv setenv { PATH } root as root
91

SEE ALSO

93     doas(1), syslogd(8)
94

HISTORY

96     The doas.conf configuration file first appeared in OpenBSD 5.8.
97

AUTHORS

99     Ted Unangst <tedu@openbsd.org>
100
101BSD                             October 9, 2020                            BSD
Impressum