1SUDOERS(5)                  BSD File Formats Manual                 SUDOERS(5)
2

NAME

4     sudoers — default sudo security policy plugin
5

DESCRIPTION

7     The sudoers policy plugin determines a user's sudo privileges.  It is the
8     default sudo policy plugin.  The policy is driven by the /etc/sudoers
9     file or, optionally in LDAP.  The policy format is described in detail in
10     the SUDOERS FILE FORMAT section.  For information on storing sudoers pol‐
11     icy information in LDAP, please see sudoers.ldap(5).
12
13   Configuring sudo.conf for sudoers
14     sudo consults the sudo.conf(5) file to determine which policy and I/O
15     logging plugins to load.  If no sudo.conf(5) file is present, or if it
16     contains no Plugin lines, sudoers will be used for policy decisions and
17     I/O logging.  To explicitly configure sudo.conf(5) to use the sudoers
18     plugin, the following configuration can be used.
19
20           Plugin sudoers_policy sudoers.so
21           Plugin sudoers_io sudoers.so
22
23     Starting with sudo 1.8.5, it is possible to specify optional arguments to
24     the sudoers plugin in the sudo.conf(5) file.  These arguments, if
25     present, should be listed after the path to the plugin (i.e., after
26     sudoers.so).  Multiple arguments may be specified, separated by white
27     space.  For example:
28
29           Plugin sudoers_policy sudoers.so sudoers_mode=0400
30
31     The following plugin arguments are supported:
32
33     ldap_conf=pathname
34               The ldap_conf argument can be used to override the default path
35               to the ldap.conf file.
36
37     ldap_secret=pathname
38               The ldap_secret argument can be used to override the default
39               path to the ldap.secret file.
40
41     sudoers_file=pathname
42               The sudoers_file argument can be used to override the default
43               path to the sudoers file.
44
45     sudoers_uid=uid
46               The sudoers_uid argument can be used to override the default
47               owner of the sudoers file.  It should be specified as a numeric
48               user ID.
49
50     sudoers_gid=gid
51               The sudoers_gid argument can be used to override the default
52               group of the sudoers file.  It must be specified as a numeric
53               group ID (not a group name).
54
55     sudoers_mode=mode
56               The sudoers_mode argument can be used to override the default
57               file mode for the sudoers file.  It should be specified as an
58               octal value.
59
60     For more information on configuring sudo.conf(5), please refer to its
61     manual.
62
63   User Authentication
64     The sudoers security policy requires that most users authenticate them‐
65     selves before they can use sudo.  A password is not required if the
66     invoking user is root, if the target user is the same as the invoking
67     user, or if the policy has disabled authentication for the user or com‐
68     mand.  Unlike su(1), when sudoers requires authentication, it validates
69     the invoking user's credentials, not the target user's (or root's) cre‐
70     dentials.  This can be changed via the rootpw, targetpw and runaspw
71     flags, described later.
72
73     If a user who is not listed in the policy tries to run a command via
74     sudo, mail is sent to the proper authorities.  The address used for such
75     mail is configurable via the mailto Defaults entry (described later) and
76     defaults to root.
77
78     Note that no mail will be sent if an unauthorized user tries to run sudo
79     with the -l or -v option unless there is an authentication error and
80     either the mail_always or mail_badpass flags are enabled.  This allows
81     users to determine for themselves whether or not they are allowed to use
82     sudo.  All attempts to run sudo (successful or not) will be logged,
83     regardless of whether or not mail is sent.
84
85     If sudo is run by root and the SUDO_USER environment variable is set, the
86     sudoers policy will use this value to determine who the actual user is.
87     This can be used by a user to log commands through sudo even when a root
88     shell has been invoked.  It also allows the -e option to remain useful
89     even when invoked via a sudo-run script or program.  Note, however, that
90     the sudoers file lookup is still done for root, not the user specified by
91     SUDO_USER.
92
93     sudoers uses per-user time stamp files for credential caching.  Once a
94     user has been authenticated, a record is written containing the user ID
95     that was used to authenticate, the terminal session ID, the start time of
96     the session leader (or parent process) and a time stamp (using a mono‐
97     tonic clock if one is available).  The user may then use sudo without a
98     password for a short period of time (5 minutes unless overridden by the
99     timestamp_timeout option).  By default, sudoers uses a separate record
100     for each terminal, which means that a user's login sessions are authenti‐
101     cated separately.  The timestamp_type option can be used to select the
102     type of time stamp record sudoers will use.
103
104   Logging
105     sudoers can log both successful and unsuccessful attempts (as well as
106     errors) to syslog(3), a log file, or both.  By default, sudoers will log
107     via syslog(3) but this is changeable via the syslog and logfile Defaults
108     settings.  See LOG FORMAT for a description of the log file format.
109
110     sudoers is also capable of running a command in a pseudo-tty and logging
111     all input and/or output.  The standard input, standard output and stan‐
112     dard error can be logged even when not associated with a terminal.  I/O
113     logging is not on by default but can be enabled using the log_input and
114     log_output options as well as the LOG_INPUT and LOG_OUTPUT command tags.
115     See I/O LOG FILES for details on how I/O log files are stored.
116
117   Command environment
118     Since environment variables can influence program behavior, sudoers pro‐
119     vides a means to restrict which variables from the user's environment are
120     inherited by the command to be run.  There are two distinct ways sudoers
121     can deal with environment variables.
122
123     By default, the env_reset option is enabled.  This causes commands to be
124     executed with a new, minimal environment.  On AIX (and Linux systems
125     without PAM), the environment is initialized with the contents of the
126     /etc/environment file.  The new environment contains the TERM, PATH,
127     HOME, MAIL, SHELL, LOGNAME, USER and SUDO_* variables in addition to
128     variables from the invoking process permitted by the env_check and
129     env_keep options.  This is effectively a whitelist for environment vari‐
130     ables.  The environment variables LOGNAME and USER are treated specially.
131     If one of them is preserved (or removed) from user's environment, the
132     other will be as well.  If LOGNAME and USER are to be preserved but only
133     one of them is present in the user's environment, the other will be set
134     to the same value.  This avoids an inconsistent environment where one of
135     the variables describing the user name is set to the invoking user and
136     one is set to the target user.  () are removed unless both the name and
137     value parts are matched by env_keep or env_check, as they may be inter‐
138     preted as functions by the bash shell.  Prior to version 1.8.11, such
139     variables were always removed.
140
141     If, however, the env_reset option is disabled, any variables not explic‐
142     itly denied by the env_check and env_delete options are inherited from
143     the invoking process.  In this case, env_check and env_delete behave like
144     a blacklist.  Prior to version 1.8.21, environment variables with a value
145     beginning with () were always removed.  Beginning with version 1.8.21, a
146     pattern in env_delete is used to match bash shell functions instead.
147     Since it is not possible to blacklist all potentially dangerous environ‐
148     ment variables, use of the default env_reset behavior is encouraged.
149
150     Environment variables specified by env_check, env_delete, or env_keep may
151     include one or more ‘*’ characters which will match zero or more charac‐
152     ters.  No other wildcard characters are supported.
153
154     By default, environment variables are matched by name.  However, if the
155     pattern includes an equal sign (‘=’), both the variables name and value
156     must match.  For example, a bash shell function could be matched as fol‐
157     lows:
158
159         env_keep += "BASH_FUNC_my_func%%=()*"
160
161     Without the “=()*” suffix, this would not match, as bash shell functions
162     are not preserved by default.
163
164     The complete list of environment variables that sudo allows or denies is
165     contained in the output of “sudo -V” when run as root.  Please note that
166     this list varies based on the operating system sudo is running on.
167
168     On systems that support PAM where the pam_env module is enabled for sudo,
169     variables in the PAM environment may be merged in to the environment.  If
170     a variable in the PAM environment is already present in the user's envi‐
171     ronment, the value will only be overridden if the variable was not pre‐
172     served by sudoers.  When env_reset is enabled, variables preserved from
173     the invoking user's environment by the env_keep list take precedence over
174     those in the PAM environment.  When env_reset is disabled, variables
175     present the invoking user's environment take precedence over those in the
176     PAM environment unless they match a pattern in the env_delete list.
177
178     Note that the dynamic linker on most operating systems will remove vari‐
179     ables that can control dynamic linking from the environment of setuid
180     executables, including sudo.  Depending on the operating system this may
181     include _RLD*, DYLD_*, LD_*, LDR_*, LIBPATH, SHLIB_PATH, and others.
182     These type of variables are removed from the environment before sudo even
183     begins execution and, as such, it is not possible for sudo to preserve
184     them.
185
186     As a special case, if sudo's -i option (initial login) is specified,
187     sudoers will initialize the environment regardless of the value of
188     env_reset.  The DISPLAY, PATH and TERM variables remain unchanged; HOME,
189     MAIL, SHELL, USER, and LOGNAME are set based on the target user.  On AIX
190     (and Linux systems without PAM), the contents of /etc/environment are
191     also included.  All other environment variables are removed unless per‐
192     mitted by env_keep or env_check, described above.
193
194     Finally, the restricted_env_file and env_file files are applied, if
195     present.  The variables in restricted_env_file are applied first and are
196     subject to the same restrictions as the invoking user's environment, as
197     detailed above.  The variables in env_file are applied last and are not
198     subject to these restrictions.  In both cases, variables present in the
199     files will only be set to their specified values if they would not con‐
200     flict with an existing environment variable.
201

SUDOERS FILE FORMAT

203     The sudoers file is composed of two types of entries: aliases (basically
204     variables) and user specifications (which specify who may run what).
205
206     When multiple entries match for a user, they are applied in order.  Where
207     there are multiple matches, the last match is used (which is not neces‐
208     sarily the most specific match).
209
210     The sudoers file grammar will be described below in Extended Backus-Naur
211     Form (EBNF).  Don't despair if you are unfamiliar with EBNF; it is fairly
212     simple, and the definitions below are annotated.
213
214   Quick guide to EBNF
215     EBNF is a concise and exact way of describing the grammar of a language.
216     Each EBNF definition is made up of production rules.  E.g.,
217
218     symbol ::= definition | alternate1 | alternate2 ...
219
220     Each production rule references others and thus makes up a grammar for
221     the language.  EBNF also contains the following operators, which many
222     readers will recognize from regular expressions.  Do not, however, con‐
223     fuse them with “wildcard” characters, which have different meanings.
224
225     ?     Means that the preceding symbol (or group of symbols) is optional.
226           That is, it may appear once or not at all.
227
228     *     Means that the preceding symbol (or group of symbols) may appear
229           zero or more times.
230
231     +     Means that the preceding symbol (or group of symbols) may appear
232           one or more times.
233
234     Parentheses may be used to group symbols together.  For clarity, we will
235     use single quotes ('') to designate what is a verbatim character string
236     (as opposed to a symbol name).
237
238   Aliases
239     There are four kinds of aliases: User_Alias, Runas_Alias, Host_Alias and
240     Cmnd_Alias.
241
242     Alias ::= 'User_Alias'  User_Alias_Spec (':' User_Alias_Spec)* |
243               'Runas_Alias' Runas_Alias_Spec (':' Runas_Alias_Spec)* |
244               'Host_Alias'  Host_Alias_Spec (':' Host_Alias_Spec)* |
245               'Cmnd_Alias'  Cmnd_Alias_Spec (':' Cmnd_Alias_Spec)*
246
247     User_Alias ::= NAME
248
249     User_Alias_Spec ::= User_Alias '=' User_List
250
251     Runas_Alias ::= NAME
252
253     Runas_Alias_Spec ::= Runas_Alias '=' Runas_List
254
255     Host_Alias ::= NAME
256
257     Host_Alias_Spec ::= Host_Alias '=' Host_List
258
259     Cmnd_Alias ::= NAME
260
261     Cmnd_Alias_Spec ::= Cmnd_Alias '=' Cmnd_List
262
263     NAME ::= [A-Z]([A-Z][0-9]_)*
264
265     Each alias definition is of the form
266
267     Alias_Type NAME = item1, item2, ...
268
269     where Alias_Type is one of User_Alias, Runas_Alias, Host_Alias, or
270     Cmnd_Alias.  A NAME is a string of uppercase letters, numbers, and under‐
271     score characters (‘_’).  A NAME must start with an uppercase letter.  It
272     is possible to put several alias definitions of the same type on a single
273     line, joined by a colon (‘:’).  E.g.,
274
275     Alias_Type NAME = item1, item2, item3 : NAME = item4, item5
276
277     It is a syntax error to redefine an existing alias.  It is possible to
278     use the same name for aliases of different types, but this is not recom‐
279     mended.
280
281     The definitions of what constitutes a valid alias member follow.
282
283     User_List ::= User |
284                   User ',' User_List
285
286     User ::= '!'* user name |
287              '!'* #uid |
288              '!'* %group |
289              '!'* %#gid |
290              '!'* +netgroup |
291              '!'* %:nonunix_group |
292              '!'* %:#nonunix_gid |
293              '!'* User_Alias
294
295     A User_List is made up of one or more user names, user IDs (prefixed with
296     ‘#’), system group names and IDs (prefixed with ‘%’ and ‘%#’ respec‐
297     tively), netgroups (prefixed with ‘+’), non-Unix group names and IDs
298     (prefixed with ‘%:’ and ‘%:#’ respectively) and User_Aliases. Each list
299     item may be prefixed with zero or more ‘!’ operators.  An odd number of
300     ‘!’ operators negate the value of the item; an even number just cancel
301     each other out.  User netgroups are matched using the user and domain
302     members only; the host member is not used when matching.
303
304     A user name, uid, group, gid, netgroup, nonunix_group or nonunix_gid may
305     be enclosed in double quotes to avoid the need for escaping special char‐
306     acters.  Alternately, special characters may be specified in escaped hex
307     mode, e.g., \x20 for space.  When using double quotes, any prefix charac‐
308     ters must be included inside the quotes.
309
310     The actual nonunix_group and nonunix_gid syntax depends on the underlying
311     group provider plugin.  For instance, the QAS AD plugin supports the fol‐
312     lowing formats:
313
314     ·  Group in the same domain: "%:Group Name"
315
316     ·  Group in any domain: "%:Group Name@FULLY.QUALIFIED.DOMAIN"
317
318     ·  Group SID: "%:S-1-2-34-5678901234-5678901234-5678901234-567"
319
320     See GROUP PROVIDER PLUGINS for more information.
321
322     Note that quotes around group names are optional.  Unquoted strings must
323     use a backslash (‘\’) to escape spaces and special characters.  See Other
324     special characters and reserved words for a list of characters that need
325     to be escaped.
326
327     Runas_List ::= Runas_Member |
328                    Runas_Member ',' Runas_List
329
330     Runas_Member ::= '!'* user name |
331                      '!'* #uid |
332                      '!'* %group |
333                      '!'* %#gid |
334                      '!'* %:nonunix_group |
335                      '!'* %:#nonunix_gid |
336                      '!'* +netgroup |
337                      '!'* Runas_Alias
338
339     A Runas_List is similar to a User_List except that instead of
340     User_Aliases it can contain Runas_Aliases.  Note that user names and
341     groups are matched as strings.  In other words, two users (groups) with
342     the same uid (gid) are considered to be distinct.  If you wish to match
343     all user names with the same uid (e.g., root and toor), you can use a uid
344     instead (#0 in the example given).
345
346     Host_List ::= Host |
347                   Host ',' Host_List
348
349     Host ::= '!'* host name |
350              '!'* ip_addr |
351              '!'* network(/netmask)? |
352              '!'* +netgroup |
353              '!'* Host_Alias
354
355     A Host_List is made up of one or more host names, IP addresses, network
356     numbers, netgroups (prefixed with ‘+’) and other aliases.  Again, the
357     value of an item may be negated with the ‘!’ operator.  Host netgroups
358     are matched using the host (both qualified and unqualified) and domain
359     members only; the user member is not used when matching.  If you specify
360     a network number without a netmask, sudo will query each of the local
361     host's network interfaces and, if the network number corresponds to one
362     of the hosts's network interfaces, will use the netmask of that inter‐
363     face.  The netmask may be specified either in standard IP address nota‐
364     tion (e.g., 255.255.255.0 or ffff:ffff:ffff:ffff::), or CIDR notation
365     (number of bits, e.g., 24 or 64).  A host name may include shell-style
366     wildcards (see the Wildcards section below), but unless the host name
367     command on your machine returns the fully qualified host name, you'll
368     need to use the fqdn option for wildcards to be useful.  Note that sudo
369     only inspects actual network interfaces; this means that IP address
370     127.0.0.1 (localhost) will never match.  Also, the host name “localhost”
371     will only match if that is the actual host name, which is usually only
372     the case for non-networked systems.
373
374     digest ::= [A-Fa-f0-9]+ |
375                [[A-Za-z0-9+/=]+
376
377     Digest_Spec ::= "sha224" ':' digest |
378                     "sha256" ':' digest |
379                     "sha384" ':' digest |
380                     "sha512" ':' digest
381
382     Cmnd_List ::= Cmnd |
383                   Cmnd ',' Cmnd_List
384
385     command name ::= file name |
386                      file name args |
387                      file name '""'
388
389     Cmnd ::= Digest_Spec? '!'* command name |
390              '!'* directory |
391              '!'* "sudoedit" |
392              '!'* Cmnd_Alias
393
394     A Cmnd_List is a list of one or more command names, directories, and
395     other aliases.  A command name is a fully qualified file name which may
396     include shell-style wildcards (see the Wildcards section below).  A sim‐
397     ple file name allows the user to run the command with any arguments
398     he/she wishes.  However, you may also specify command line arguments
399     (including wildcards).  Alternately, you can specify "" to indicate that
400     the command may only be run without command line arguments.  A directory
401     is a fully qualified path name ending in a ‘/’.  When you specify a
402     directory in a Cmnd_List, the user will be able to run any file within
403     that directory (but not in any sub-directories therein).
404
405     If a Cmnd has associated command line arguments, then the arguments in
406     the Cmnd must match exactly those given by the user on the command line
407     (or match the wildcards if there are any).  Note that the following char‐
408     acters must be escaped with a ‘\’ if they are used in command arguments:
409     ‘,’, ‘:’, ‘=’, ‘\’.  The built-in command “sudoedit” is used to permit a
410     user to run sudo with the -e option (or as sudoedit).  It may take com‐
411     mand line arguments just as a normal command does.  Note that “sudoedit”
412     is a command built into sudo itself and must be specified in the sudoers
413     file without a leading path.
414
415     If a command name is prefixed with a Digest_Spec, the command will only
416     match successfully if it can be verified using the specified SHA-2
417     digest.  The following digest formats are supported: sha224, sha256,
418     sha384 and sha512.  The string may be specified in either hex or base64
419     format (base64 is more compact).  There are several utilities capable of
420     generating SHA-2 digests in hex format such as openssl, shasum,
421     sha224sum, sha256sum, sha384sum, sha512sum.
422
423     For example, using openssl:
424
425     $ openssl dgst -sha224 /bin/ls
426     SHA224(/bin/ls)= 118187da8364d490b4a7debbf483004e8f3e053ec954309de2c41a25
427
428     It is also possible to use openssl to generate base64 output:
429
430     $ openssl dgst -binary -sha224 /bin/ls | openssl base64
431     EYGH2oNk1JC0p9679IMATo8+BT7JVDCd4sQaJQ==
432
433     Warning, if the user has write access to the command itself (directly or
434     via a sudo command), it may be possible for the user to replace the com‐
435     mand after the digest check has been performed but before the command is
436     executed.  A similar race condition exists on systems that lack the
437     fexecve(2) system call when the directory in which the command is located
438     is writable by the user.  See the description of the fdexec setting for
439     more information on how sudo executes commands that have an associated
440     digest.
441
442     Command digests are only supported by version 1.8.7 or higher.
443
444   Defaults
445     Certain configuration options may be changed from their default values at
446     run-time via one or more Default_Entry lines.  These may affect all users
447     on any host, all users on a specific host, a specific user, a specific
448     command, or commands being run as a specific user.  Note that per-command
449     entries may not include command line arguments.  If you need to specify
450     arguments, define a Cmnd_Alias and reference that instead.
451
452     Default_Type ::= 'Defaults' |
453                      'Defaults' '@' Host_List |
454                      'Defaults' ':' User_List |
455                      'Defaults' '!' Cmnd_List |
456                      'Defaults' '>' Runas_List
457
458     Default_Entry ::= Default_Type Parameter_List
459
460     Parameter_List ::= Parameter |
461                        Parameter ',' Parameter_List
462
463     Parameter ::= Parameter '=' Value |
464                   Parameter '+=' Value |
465                   Parameter '-=' Value |
466                   '!'* Parameter
467
468     Parameters may be flags, integer values, strings, or lists.  Flags are
469     implicitly boolean and can be turned off via the ‘!’ operator.  Some
470     integer, string and list parameters may also be used in a boolean context
471     to disable them.  Values may be enclosed in double quotes ("") when they
472     contain multiple words.  Special characters may be escaped with a back‐
473     slash (‘\’).
474
475     Lists have two additional assignment operators, += and -=.  These opera‐
476     tors are used to add to and delete from a list respectively.  It is not
477     an error to use the -= operator to remove an element that does not exist
478     in a list.
479
480     Defaults entries are parsed in the following order: generic, host, user
481     and runas Defaults first, then command defaults.  If there are multiple
482     Defaults settings of the same type, the last matching setting is used.
483     The following Defaults settings are parsed before all others since they
484     may affect subsequent entries: fqdn, group_plugin, runas_default,
485     sudoers_locale.
486
487     See SUDOERS OPTIONS for a list of supported Defaults parameters.
488
489   User specification
490     User_Spec ::= User_List Host_List '=' Cmnd_Spec_List \
491                   (':' Host_List '=' Cmnd_Spec_List)*
492
493     Cmnd_Spec_List ::= Cmnd_Spec |
494                        Cmnd_Spec ',' Cmnd_Spec_List
495
496     Cmnd_Spec ::= Runas_Spec? Option_Spec* Tag_Spec* Cmnd
497
498     Runas_Spec ::= '(' Runas_List? (':' Runas_List)? ')'
499
500     Option_Spec ::= (SELinux_Spec | Date_Spec | Timeout_Spec)
501
502     SELinux_Spec ::= ('ROLE=role' | 'TYPE=type')
503
504     Date_Spec ::= ('NOTBEFORE=timestamp' | 'NOTAFTER=timestamp')
505
506     Timeout_Spec ::= 'TIMEOUT=timeout'
507
508     Tag_Spec ::= ('EXEC:' | 'NOEXEC:' | 'FOLLOW:' | 'NOFOLLOW' |
509                   'LOG_INPUT:' | 'NOLOG_INPUT:' | 'LOG_OUTPUT:' |
510                   'NOLOG_OUTPUT:' | 'MAIL:' | 'NOMAIL:' | 'PASSWD:' |
511                   'NOPASSWD:' | 'SETENV:' | 'NOSETENV:')
512
513     A user specification determines which commands a user may run (and as
514     what user) on specified hosts.  By default, commands are run as root, but
515     this can be changed on a per-command basis.
516
517     The basic structure of a user specification is “who where = (as_whom)
518     what”.  Let's break that down into its constituent parts:
519
520   Runas_Spec
521     A Runas_Spec determines the user and/or the group that a command may be
522     run as.  A fully-specified Runas_Spec consists of two Runas_Lists (as
523     defined above) separated by a colon (‘:’) and enclosed in a set of paren‐
524     theses.  The first Runas_List indicates which users the command may be
525     run as via sudo's -u option.  The second defines a list of groups that
526     can be specified via sudo's -g option in addition to any of the target
527     user's groups.  If both Runas_Lists are specified, the command may be run
528     with any combination of users and groups listed in their respective
529     Runas_Lists. If only the first is specified, the command may be run as
530     any user in the list but no -g option may be specified.  If the first
531     Runas_List is empty but the second is specified, the command may be run
532     as the invoking user with the group set to any listed in the Runas_List.
533     If both Runas_Lists are empty, the command may only be run as the invok‐
534     ing user.  If no Runas_Spec is specified the command may be run as root
535     and no group may be specified.
536
537     A Runas_Spec sets the default for the commands that follow it.  What this
538     means is that for the entry:
539
540     dgb     boulder = (operator) /bin/ls, /bin/kill, /usr/bin/lprm
541
542     The user dgb may run /bin/ls, /bin/kill, and /usr/bin/lprm on the host
543     boulder—but only as operator.  E.g.,
544
545     $ sudo -u operator /bin/ls
546
547     It is also possible to override a Runas_Spec later on in an entry.  If we
548     modify the entry like so:
549
550     dgb     boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm
551
552     Then user dgb is now allowed to run /bin/ls as operator, but /bin/kill
553     and /usr/bin/lprm as root.
554
555     We can extend this to allow dgb to run /bin/ls with either the user or
556     group set to operator:
557
558     dgb     boulder = (operator : operator) /bin/ls, (root) /bin/kill,\
559             /usr/bin/lprm
560
561     Note that while the group portion of the Runas_Spec permits the user to
562     run as command with that group, it does not force the user to do so.  If
563     no group is specified on the command line, the command will run with the
564     group listed in the target user's password database entry.  The following
565     would all be permitted by the sudoers entry above:
566
567     $ sudo -u operator /bin/ls
568     $ sudo -u operator -g operator /bin/ls
569     $ sudo -g operator /bin/ls
570
571     In the following example, user tcm may run commands that access a modem
572     device file with the dialer group.
573
574     tcm     boulder = (:dialer) /usr/bin/tip, /usr/bin/cu,\
575             /usr/local/bin/minicom
576
577     Note that in this example only the group will be set, the command still
578     runs as user tcm.  E.g.
579
580     $ sudo -g dialer /usr/bin/cu
581
582     Multiple users and groups may be present in a Runas_Spec, in which case
583     the user may select any combination of users and groups via the -u and -g
584     options.  In this example:
585
586     alan    ALL = (root, bin : operator, system) ALL
587
588     user alan may run any command as either user root or bin, optionally set‐
589     ting the group to operator or system.
590
591   Option_Spec
592     A Cmnd may have zero or more options associated with it.  Options may
593     consist of SELinux roles and/or types, start and/or end dates and command
594     timeouts.  Once an option is set for a Cmnd, subsequent Cmnds in the
595     Cmnd_Spec_List, inherit that option unless it is overridden by another
596     option.
597
598   SELinux_Spec
599     On systems with SELinux support, sudoers file entries may optionally have
600     an SELinux role and/or type associated with a command.  If a role or type
601     is specified with the command it will override any default values speci‐
602     fied in sudoers.  A role or type specified on the command line, however,
603     will supersede the values in sudoers.
604
605   Date_Spec
606     sudoers rules can be specified with a start and end date via the
607     NOTBEFORE and NOTAFTER settings.  The time stamp must be specified in
608     Generalized Time as defined by RFC 4517.  The format is effectively
609     yyyymmddHHMMSSZ where the minutes and seconds are optional.  The ‘Z’ suf‐
610     fix indicates that the time stamp is in Coordinated Universal Time (UTC).
611     It is also possible to specify a timezone offset from UTC in hours and
612     minutes instead of a ‘Z’.  For example, ‘-0500’ would correspond to East‐
613     ern Standard time in the US.  As an extension, if no ‘Z’ or timezone off‐
614     set is specified, local time will be used.
615
616     The following are all valid time stamps:
617
618         20170214083000Z
619         2017021408Z
620         20160315220000-0500
621         20151201235900
622
623   Timeout_Spec
624     A command may have a timeout associated with it.  If the timeout expires
625     before the command has exited, the command will be terminated.  The time‐
626     out may be specified in combinations of days, hours, minutes and seconds
627     with a single-letter case-insensitive suffix that indicates the unit of
628     time.  For example, a timeout of 7 days, 8 hours, 30 minutes and 10 sec‐
629     onds would be written as 7d8h30m10s.  If a number is specified without a
630     unit, seconds are assumed.  Any of the days, minutes, hours or seconds
631     may be omitted.  The order must be from largest to smallest unit and a
632     unit may not be specified more than once.
633
634     The following are all valid timeout values: 7d8h30m10s, 14d, 8h30m, 600s,
635     3600.  The following are invalid timeout values: 12m2w1d, 30s10m4h,
636     1d2d3h.
637
638     This option is only supported by version 1.8.20 or higher.
639
640   Tag_Spec
641     A command may have zero or more tags associated with it.  The following
642     tag values are supported: EXEC, NOEXEC, FOLLOW, NOFOLLOW, LOG_INPUT,
643     NOLOG_INPUT, LOG_OUTPUT, NOLOG_OUTPUT, MAIL, NOMAIL, PASSWD, NOPASSWD,
644     SETENV, and NOSETENV.  Once a tag is set on a Cmnd, subsequent Cmnds in
645     the Cmnd_Spec_List, inherit the tag unless it is overridden by the oppo‐
646     site tag (in other words, PASSWD overrides NOPASSWD and NOEXEC overrides
647     EXEC).
648
649     EXEC and NOEXEC
650
651       If sudo has been compiled with noexec support and the underlying oper‐
652       ating system supports it, the NOEXEC tag can be used to prevent a
653       dynamically-linked executable from running further commands itself.
654
655       In the following example, user aaron may run /usr/bin/more and
656       /usr/bin/vi but shell escapes will be disabled.
657
658       aaron   shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
659
660       See the Preventing shell escapes section below for more details on how
661       NOEXEC works and whether or not it will work on your system.
662
663     FOLLOW and NOFOLLOW Starting with version 1.8.15, sudoedit will not open
664       a file that is a symbolic link unless the sudoedit_follow option is
665       enabled.  The FOLLOW and NOFOLLOW tags override the value of
666       sudoedit_follow and can be used to permit (or deny) the editing of sym‐
667       bolic links on a per-command basis.  These tags are only effective for
668       the sudoedit command and are ignored for all other commands.
669
670     LOG_INPUT and NOLOG_INPUT
671
672       These tags override the value of the log_input option on a per-command
673       basis.  For more information, see the description of log_input in the
674       SUDOERS OPTIONS section below.
675
676     LOG_OUTPUT and NOLOG_OUTPUT
677
678       These tags override the value of the log_output option on a per-command
679       basis.  For more information, see the description of log_output in the
680       SUDOERS OPTIONS section below.
681
682     MAIL and NOMAIL
683
684       These tags provide fine-grained control over whether mail will be sent
685       when a user runs a command by overriding the value of the
686       mail_all_cmnds option on a per-command basis.  They have no effect when
687       sudo is run with the -l or -v options.  A NOMAIL tag will also override
688       the mail_always and mail_no_perms options.  For more information, see
689       the descriptions of mail_all_cmnds, mail_always, and mail_no_perms in
690       the SUDOERS OPTIONS section below.
691
692     PASSWD and NOPASSWD
693
694       By default, sudo requires that a user authenticate him or herself
695       before running a command.  This behavior can be modified via the
696       NOPASSWD tag.  Like a Runas_Spec, the NOPASSWD tag sets a default for
697       the commands that follow it in the Cmnd_Spec_List.  Conversely, the
698       PASSWD tag can be used to reverse things.  For example:
699
700       ray     rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
701
702       would allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm
703       as root on the machine rushmore without authenticating himself.  If we
704       only want ray to be able to run /bin/kill without a password the entry
705       would be:
706
707       ray     rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
708
709       Note, however, that the PASSWD tag has no effect on users who are in
710       the group specified by the exempt_group option.
711
712       By default, if the NOPASSWD tag is applied to any of the entries for a
713       user on the current host, he or she will be able to run “sudo -l” with‐
714       out a password.  Additionally, a user may only run “sudo -v” without a
715       password if the NOPASSWD tag is present for all a user's entries that
716       pertain to the current host.  This behavior may be overridden via the
717       verifypw and listpw options.
718
719     SETENV and NOSETENV
720
721       These tags override the value of the setenv option on a per-command
722       basis.  Note that if SETENV has been set for a command, the user may
723       disable the env_reset option from the command line via the -E option.
724       Additionally, environment variables set on the command line are not
725       subject to the restrictions imposed by env_check, env_delete, or
726       env_keep.  As such, only trusted users should be allowed to set vari‐
727       ables in this manner.  If the command matched is ALL, the SETENV tag is
728       implied for that command; this default may be overridden by use of the
729       NOSETENV tag.
730
731   Wildcards
732     sudo allows shell-style wildcards (aka meta or glob characters) to be
733     used in host names, path names and command line arguments in the sudoers
734     file.  Wildcard matching is done via the glob(3) and fnmatch(3) functions
735     as specified by IEEE Std 1003.1 (“POSIX.1”).
736
737     *         Matches any set of zero or more characters (including white
738               space).
739
740     ?         Matches any single character (including white space).
741
742     [...]     Matches any character in the specified range.
743
744     [!...]    Matches any character not in the specified range.
745
746     \x        For any character ‘x’, evaluates to ‘x’.  This is used to
747               escape special characters such as: ‘*’, ‘?’, ‘[’, and ‘]’.
748
749     Note that these are not regular expressions.  Unlike a regular expression
750     there is no way to match one or more characters within a range.
751
752     Character classes may be used if your system's glob(3) and fnmatch(3)
753     functions support them.  However, because the ‘:’ character has special
754     meaning in sudoers, it must be escaped.  For example:
755
756         /bin/ls [[\:alpha\:]]*
757
758     Would match any file name beginning with a letter.
759
760     Note that a forward slash (‘/’) will not be matched by wildcards used in
761     the file name portion of the command.  This is to make a path like:
762
763         /usr/bin/*
764
765     match /usr/bin/who but not /usr/bin/X11/xterm.
766
767     When matching the command line arguments, however, a slash does get
768     matched by wildcards since command line arguments may contain arbitrary
769     strings and not just path names.
770
771     Wildcards in command line arguments should be used with care.
772     Command line arguments are matched as a single, concatenated string.
773     This mean a wildcard character such as ‘?’ or ‘*’ will match across word
774     boundaries, which may be unexpected.  For example, while a sudoers entry
775     like:
776
777         %operator ALL = /bin/cat /var/log/messages*
778
779     will allow command like:
780
781         $ sudo cat /var/log/messages.1
782
783     It will also allow:
784
785         $ sudo cat /var/log/messages /etc/shadow
786
787     which is probably not what was intended.  In most cases it is better to
788     do command line processing outside of the sudoers file in a scripting
789     language.
790
791   Exceptions to wildcard rules
792     The following exceptions apply to the above rules:
793
794     ""        If the empty string "" is the only command line argument in the
795               sudoers file entry it means that command is not allowed to be
796               run with any arguments.
797
798     sudoedit  Command line arguments to the sudoedit built-in command should
799               always be path names, so a forward slash (‘/’) will not be
800               matched by a wildcard.
801
802   Including other files from within sudoers
803     It is possible to include other sudoers files from within the sudoers
804     file currently being parsed using the #include and #includedir direc‐
805     tives.
806
807     This can be used, for example, to keep a site-wide sudoers file in addi‐
808     tion to a local, per-machine file.  For the sake of this example the
809     site-wide sudoers file will be /etc/sudoers and the per-machine one will
810     be /etc/sudoers.local.  To include /etc/sudoers.local from within
811     /etc/sudoers we would use the following line in /etc/sudoers:
812
813         #include /etc/sudoers.local
814
815     When sudo reaches this line it will suspend processing of the current
816     file (/etc/sudoers) and switch to /etc/sudoers.local.  Upon reaching the
817     end of /etc/sudoers.local, the rest of /etc/sudoers will be processed.
818     Files that are included may themselves include other files.  A hard limit
819     of 128 nested include files is enforced to prevent include file loops.
820
821     If the path to the include file is not fully-qualified (does not begin
822     with a ‘/’), it must be located in the same directory as the sudoers file
823     it was included from.  For example, if /etc/sudoers contains the line:
824
825         #include sudoers.local
826
827     the file that will be included is /etc/sudoers.local.
828
829     The file name may also include the %h escape, signifying the short form
830     of the host name.  In other words, if the machine's host name is
831     “xerxes”, then
832
833         #include /etc/sudoers.%h
834
835     will cause sudo to include the file /etc/sudoers.xerxes.
836
837     The #includedir directive can be used to create a sudoers.d directory
838     that the system package manager can drop sudoers file rules into as part
839     of package installation.  For example, given:
840
841         #includedir /etc/sudoers.d
842
843     sudo will suspend processing of the current file and read each file in
844     /etc/sudoers.d, skipping file names that end in ‘~’ or contain a ‘.’
845     character to avoid causing problems with package manager or editor tempo‐
846     rary/backup files.  Files are parsed in sorted lexical order.  That is,
847     /etc/sudoers.d/01_first will be parsed before /etc/sudoers.d/10_second.
848     Be aware that because the sorting is lexical, not numeric,
849     /etc/sudoers.d/1_whoops would be loaded after /etc/sudoers.d/10_second.
850     Using a consistent number of leading zeroes in the file names can be used
851     to avoid such problems.  After parsing the files in the directory, con‐
852     trol returns to the file that contained the #includedir directive.
853
854     Note that unlike files included via #include, visudo will not edit the
855     files in a #includedir directory unless one of them contains a syntax
856     error.  It is still possible to run visudo with the -f flag to edit the
857     files directly, but this will not catch the redefinition of an alias that
858     is also present in a different file.
859
860   Other special characters and reserved words
861     The pound sign (‘#’) is used to indicate a comment (unless it is part of
862     a #include directive or unless it occurs in the context of a user name
863     and is followed by one or more digits, in which case it is treated as a
864     uid).  Both the comment character and any text after it, up to the end of
865     the line, are ignored.
866
867     The reserved word ALL is a built-in alias that always causes a match to
868     succeed.  It can be used wherever one might otherwise use a Cmnd_Alias,
869     User_Alias, Runas_Alias, or Host_Alias.  You should not try to define
870     your own alias called ALL as the built-in alias will be used in prefer‐
871     ence to your own.  Please note that using ALL can be dangerous since in a
872     command context, it allows the user to run any command on the system.
873
874     An exclamation point (‘!’) can be used as a logical not operator in a
875     list or alias as well as in front of a Cmnd.  This allows one to exclude
876     certain values.  For the ‘!’ operator to be effective, there must be
877     something for it to exclude.  For example, to match all users except for
878     root one would use:
879
880         ALL,!root
881
882     If the ALL, is omitted, as in:
883
884         !root
885
886     it would explicitly deny root but not match any other users.  This is
887     different from a true “negation” operator.
888
889     Note, however, that using a ‘!’ in conjunction with the built-in ALL
890     alias to allow a user to run “all but a few” commands rarely works as
891     intended (see SECURITY NOTES below).
892
893     Long lines can be continued with a backslash (‘\’) as the last character
894     on the line.
895
896     White space between elements in a list as well as special syntactic char‐
897     acters in a User Specification (‘=’, ‘:’, ‘(’, ‘)’) is optional.
898
899     The following characters must be escaped with a backslash (‘\’) when used
900     as part of a word (e.g., a user name or host name): ‘!’, ‘=’, ‘:’, ‘,’,
901     ‘(’, ‘)’, ‘\’.
902

SUDOERS OPTIONS

904     sudo's behavior can be modified by Default_Entry lines, as explained ear‐
905     lier.  A list of all supported Defaults parameters, grouped by type, are
906     listed below.
907
908     Boolean Flags:
909
910     always_query_group_plugin
911                       If a group_plugin is configured, use it to resolve
912                       groups of the form %group as long as there is not also
913                       a system group of the same name.  Normally, only groups
914                       of the form %:group are passed to the group_plugin.
915                       This flag is off by default.
916
917     always_set_home   If enabled, sudo will set the HOME environment variable
918                       to the home directory of the target user (which is root
919                       unless the -u option is used).  This effectively means
920                       that the -H option is always implied.  Note that by
921                       default, HOME will be set to the home directory of the
922                       target user when the env_reset option is enabled, so
923                       always_set_home only has an effect for configurations
924                       where either env_reset is disabled or HOME is present
925                       in the env_keep list.  This flag is off by default.
926
927     authenticate      If set, users must authenticate themselves via a pass‐
928                       word (or other means of authentication) before they may
929                       run commands.  This default may be overridden via the
930                       PASSWD and NOPASSWD tags.  This flag is on by default.
931
932     case_insensitive_group
933                       If enabled, group names in sudoers will be matched in a
934                       case insensitive manner.  This may be necessary when
935                       users are stored in LDAP or AD.  This flag is on by
936                       default.
937
938     case_insensitive_user
939                       If enabled, user names in sudoers will be matched in a
940                       case insensitive manner.  This may be necessary when
941                       groups are stored in LDAP or AD.  This flag is on by
942                       default.
943
944     closefrom_override
945                       If set, the user may use sudo's -C option which over‐
946                       rides the default starting point at which sudo begins
947                       closing open file descriptors.  This flag is off by
948                       default.
949
950     compress_io       If set, and sudo is configured to log a command's input
951                       or output, the I/O logs will be compressed using zlib.
952                       This flag is on by default when sudo is compiled with
953                       zlib support.
954
955     exec_background   By default, sudo runs a command as the foreground
956                       process as long as sudo itself is running in the fore‐
957                       ground.  When the exec_background flag is enabled and
958                       the command is being run in a pty (due to I/O logging
959                       or the use_pty flag), the command will be run as a
960                       background process.  Attempts to read from the control‐
961                       ling terminal (or to change terminal settings) will
962                       result in the command being suspended with the SIGTTIN
963                       signal (or SIGTTOU in the case of terminal settings).
964                       If this happens when sudo is a foreground process, the
965                       command will be granted the controlling terminal and
966                       resumed in the foreground with no user intervention
967                       required.  The advantage of initially running the com‐
968                       mand in the background is that sudo need not read from
969                       the terminal unless the command explicitly requests it.
970                       Otherwise, any terminal input must be passed to the
971                       command, whether it has required it or not (the kernel
972                       buffers terminals so it is not possible to tell whether
973                       the command really wants the input).  This is different
974                       from historic sudo behavior or when the command is not
975                       being run in a pty.
976
977                       For this to work seamlessly, the operating system must
978                       support the automatic restarting of system calls.
979                       Unfortunately, not all operating systems do this by
980                       default, and even those that do may have bugs.  For
981                       example, macOS fails to restart the tcgetattr() and
982                       tcsetattr() system calls (this is a bug in macOS).
983                       Furthermore, because this behavior depends on the com‐
984                       mand stopping with the SIGTTIN or SIGTTOU signals, pro‐
985                       grams that catch these signals and suspend themselves
986                       with a different signal (usually SIGTOP) will not be
987                       automatically foregrounded.  Some versions of the linux
988                       su(1) command behave this way.  This flag is off by
989                       default.
990
991                       This setting is only supported by version 1.8.7 or
992                       higher.  It has no effect unless I/O logging is enabled
993                       or the use_pty flag is enabled.
994
995     env_editor        If set, visudo will use the value of the SUDO_EDITOR,
996                       VISUAL or EDITOR environment variables before falling
997                       back on the default editor list.  Note that this may
998                       create a security hole as it allows the user to run any
999                       arbitrary command as root without logging.  A safer
1000                       alternative is to place a colon-separated list of edi‐
1001                       tors in the editor variable.  visudo will then only use
1002                       SUDO_EDITOR, VISUAL or EDITOR if they match a value
1003                       specified in editor.  If the env_reset flag is enabled,
1004                       the SUDO_EDITOR, VISUAL and/or EDITOR environment vari‐
1005                       ables must be present in the env_keep list for the
1006                       env_editor flag to function when visudo is invoked via
1007                       sudo.  This flag is on by default.
1008
1009     env_reset         If set, sudo will run the command in a minimal environ‐
1010                       ment containing the TERM, PATH, HOME, MAIL, SHELL,
1011                       LOGNAME, USER and SUDO_* variables.  Any variables in
1012                       the caller's environment or in the file specified by
1013                       the restricted_env_file option that match the env_keep
1014                       and env_check lists are then added, followed by any
1015                       variables present in the file specified by the env_file
1016                       option (if any).  The contents of the env_keep and
1017                       env_check lists, as modified by global Defaults parame‐
1018                       ters in sudoers, are displayed when sudo is run by root
1019                       with the -V option.  If the secure_path option is set,
1020                       its value will be used for the PATH environment vari‐
1021                       able.  This flag is on by default.
1022
1023     fast_glob         Normally, sudo uses the glob(3) function to do shell-
1024                       style globbing when matching path names.  However,
1025                       since it accesses the file system, glob(3) can take a
1026                       long time to complete for some patterns, especially
1027                       when the pattern references a network file system that
1028                       is mounted on demand (auto mounted).  The fast_glob
1029                       option causes sudo to use the fnmatch(3) function,
1030                       which does not access the file system to do its match‐
1031                       ing.  The disadvantage of fast_glob is that it is
1032                       unable to match relative path names such as ./ls or
1033                       ../bin/ls.  This has security implications when path
1034                       names that include globbing characters are used with
1035                       the negation operator, ‘!’, as such rules can be triv‐
1036                       ially bypassed.  As such, this option should not be
1037                       used when the sudoers file contains rules that contain
1038                       negated path names which include globbing characters.
1039                       This flag is off by default.
1040
1041     fqdn              Set this flag if you want to put fully qualified host
1042                       names in the sudoers file when the local host name (as
1043                       returned by the hostname command) does not contain the
1044                       domain name.  In other words, instead of myhost you
1045                       would use myhost.mydomain.edu.  You may still use the
1046                       short form if you wish (and even mix the two).  This
1047                       option is only effective when the “canonical” host
1048                       name, as returned by the getaddrinfo() or
1049                       gethostbyname() function, is a fully-qualified domain
1050                       name.  This is usually the case when the system is con‐
1051                       figured to use DNS for host name resolution.
1052
1053                       If the system is configured to use the /etc/hosts file
1054                       in preference to DNS, the “canonical” host name may not
1055                       be fully-qualified.  The order that sources are queried
1056                       for host name resolution is usually specified in the
1057                       /etc/nsswitch.conf, /etc/netsvc.conf, /etc/host.conf,
1058                       or, in some cases, /etc/resolv.conf file.  In the
1059                       /etc/hosts file, the first host name of the entry is
1060                       considered to be the “canonical” name; subsequent names
1061                       are aliases that are not used by sudoers.  For example,
1062                       the following hosts file line for the machine “xyzzy”
1063                       has the fully-qualified domain name as the “canonical”
1064                       host name, and the short version as an alias.
1065
1066                             192.168.1.1    xyzzy.sudo.ws xyzzy
1067
1068                       If the machine's hosts file entry is not formatted
1069                       properly, the fqdn option will not be effective if it
1070                       is queried before DNS.
1071
1072                       Beware that when using DNS for host name resolution,
1073                       turning on fqdn requires sudoers to make DNS lookups
1074                       which renders sudo unusable if DNS stops working (for
1075                       example if the machine is disconnected from the net‐
1076                       work).  Also note that just like with the hosts file,
1077                       you must use the “canonical” name as DNS knows it.
1078                       That is, you may not use a host alias (CNAME entry) due
1079                       to performance issues and the fact that there is no way
1080                       to get all aliases from DNS.
1081
1082                       This flag is off by default.
1083
1084     ignore_audit_errors
1085                       Allow commands to be run even if sudoers cannot write
1086                       to the audit log.  If enabled, an audit log write fail‐
1087                       ure is not treated as a fatal error.  If disabled, a
1088                       command may only be run after the audit event is suc‐
1089                       cessfully written.  This flag is only effective on sys‐
1090                       tems for which sudoers supports audit logging, includ‐
1091                       ing FreeBSD, Linux, macOS and Solaris.  This flag is on
1092                       by default.
1093
1094     ignore_dot        If set, sudo will ignore "." or "" (both denoting cur‐
1095                       rent directory) in the PATH environment variable; the
1096                       PATH itself is not modified.  This flag is on by
1097                       default.
1098
1099     ignore_iolog_errors
1100                       Allow commands to be run even if sudoers cannot write
1101                       to the I/O log.  If enabled, an I/O log write failure
1102                       is not treated as a fatal error.  If disabled, the com‐
1103                       mand will be terminated if the I/O log cannot be writ‐
1104                       ten to.  This flag is off by default.
1105
1106     ignore_logfile_errors
1107                       Allow commands to be run even if sudoers cannot write
1108                       to the log file.  If enabled, a log file write failure
1109                       is not treated as a fatal error.  If disabled, a com‐
1110                       mand may only be run after the log file entry is suc‐
1111                       cessfully written.  This flag only has an effect when
1112                       sudoers is configured to use file-based logging via the
1113                       logfile option.  This flag is on by default.
1114
1115     ignore_local_sudoers
1116                       If set via LDAP, parsing of /etc/sudoers will be
1117                       skipped.  This is intended for Enterprises that wish to
1118                       prevent the usage of local sudoers files so that only
1119                       LDAP is used.  This thwarts the efforts of rogue opera‐
1120                       tors who would attempt to add roles to /etc/sudoers.
1121                       When this option is present, /etc/sudoers does not even
1122                       need to exist.  Since this option tells sudo how to
1123                       behave when no specific LDAP entries have been matched,
1124                       this sudoOption is only meaningful for the cn=defaults
1125                       section.  This flag is off by default.
1126
1127     ignore_unknown_defaults
1128                       If set, sudo will not produce a warning if it encoun‐
1129                       ters an unknown Defaults entry in the sudoers file or
1130                       an unknown sudoOption in LDAP.  This flag is off by
1131                       default.
1132
1133     insults           If set, sudo will insult users when they enter an
1134                       incorrect password.  This flag is off by default.
1135
1136     log_host          If set, the host name will be logged in the (non-sys‐
1137                       log) sudo log file.  This flag is off by default.
1138
1139     log_input         If set, sudo will run the command in a pseudo-tty and
1140                       log all user input.  If the standard input is not con‐
1141                       nected to the user's tty, due to I/O redirection or
1142                       because the command is part of a pipeline, that input
1143                       is also captured and stored in a separate log file.
1144                       Anything sent to the standard input will be consumed,
1145                       regardless of whether or not the command run via sudo
1146                       is actually reading the standard input.  This may have
1147                       unexpected results when using sudo in a shell script
1148                       that expects to process the standard input.  For more
1149                       information about I/O logging, see the I/O LOG FILES
1150                       section.  This flag is off by default.
1151
1152     log_output        If set, sudo will run the command in a pseudo-tty and
1153                       log all output that is sent to the screen, similar to
1154                       the script(1) command.  For more information about I/O
1155                       logging, see the I/O LOG FILES section.  This flag is
1156                       off by default.
1157
1158     log_year          If set, the four-digit year will be logged in the (non-
1159                       syslog) sudo log file.  This flag is off by default.
1160
1161     long_otp_prompt   When validating with a One Time Password (OTP) scheme
1162                       such as S/Key or OPIE, a two-line prompt is used to
1163                       make it easier to cut and paste the challenge to a
1164                       local window.  It's not as pretty as the default but
1165                       some people find it more convenient.  This flag is off
1166                       by default.
1167
1168     mail_all_cmnds    Send mail to the mailto user every time a user attempts
1169                       to run a command via sudo (this includes sudoedit).  No
1170                       mail will be sent if the user runs sudo with the -l or
1171                       -v option unless there is an authentication error and
1172                       the mail_badpass flag is also set.  This flag is off by
1173                       default.
1174
1175     mail_always       Send mail to the mailto user every time a user runs
1176                       sudo.  This flag is off by default.
1177
1178     mail_badpass      Send mail to the mailto user if the user running sudo
1179                       does not enter the correct password.  If the command
1180                       the user is attempting to run is not permitted by
1181                       sudoers and one of the mail_all_cmnds, mail_always,
1182                       mail_no_host, mail_no_perms or mail_no_user flags are
1183                       set, this flag will have no effect.  This flag is off
1184                       by default.
1185
1186     mail_no_host      If set, mail will be sent to the mailto user if the
1187                       invoking user exists in the sudoers file, but is not
1188                       allowed to run commands on the current host.  This flag
1189                       is off by default.
1190
1191     mail_no_perms     If set, mail will be sent to the mailto user if the
1192                       invoking user is allowed to use sudo but the command
1193                       they are trying is not listed in their sudoers file
1194                       entry or is explicitly denied.  This flag is off by
1195                       default.
1196
1197     mail_no_user      If set, mail will be sent to the mailto user if the
1198                       invoking user is not in the sudoers file.  This flag is
1199                       on by default.
1200
1201     match_group_by_gid
1202                       By default, sudoers will look up each group the user is
1203                       a member of by group ID to determine the group name
1204                       (this is only done once).  The resulting list of the
1205                       user's group names is used when matching groups listed
1206                       in the sudoers file.  This works well on systems where
1207                       the number of groups listed in the sudoers file is
1208                       larger than the number of groups a typical user belongs
1209                       to.  On systems where group lookups are slow, where
1210                       users may belong to a large number of groups, and where
1211                       the number of groups listed in the sudoers file is rel‐
1212                       atively small, it may be prohibitively expensive and
1213                       running commands via sudo may take longer than normal.
1214                       On such systems it may be faster to use the
1215                       match_group_by_gid flag to avoid resolving the user's
1216                       group IDs to group names.  In this case, sudoers must
1217                       look up any group name listed in the sudoers file and
1218                       use the group ID instead of the group name when deter‐
1219                       mining whether the user is a member of the group.
1220
1221                       Note that if match_group_by_gid is enabled, group data‐
1222                       base lookups performed by sudoers will be keyed by
1223                       group name as opposed to group ID.  On systems where
1224                       there are multiple sources for the group database, it
1225                       is possible to have conflicting group names or group
1226                       IDs in the local /etc/group file and the remote group
1227                       database.  On such systems, enabling or disabling
1228                       match_group_by_gid can be used to choose whether group
1229                       database queries are performed by name (enabled) or ID
1230                       (disabled), which may aid in working around group entry
1231                       conflicts.
1232
1233                       The match_group_by_gid flag has no effect when sudoers
1234                       data is stored in LDAP.  This flag is off by default.
1235
1236                       This setting is only supported by version 1.8.18 or
1237                       higher.
1238
1239     netgroup_tuple    If set, netgroup lookups will be performed using the
1240                       full netgroup tuple: host name, user name and domain
1241                       (if one is set).  Historically, sudo only matched the
1242                       user name and domain for netgroups used in a User_List
1243                       and only matched the host name and domain for netgroups
1244                       used in a Host_List.  This flag is off by default.
1245
1246     noexec            If set, all commands run via sudo will behave as if the
1247                       NOEXEC tag has been set, unless overridden by an EXEC
1248                       tag.  See the description of EXEC and NOEXEC above as
1249                       well as the Preventing shell escapes section at the end
1250                       of this manual.  This flag is off by default.
1251
1252     pam_session       On systems that use PAM for authentication, sudo will
1253                       create a new PAM session for the command to be run in.
1254                       Disabling pam_session may be needed on older PAM imple‐
1255                       mentations or on operating systems where opening a PAM
1256                       session changes the utmp or wtmp files.  If PAM session
1257                       support is disabled, resource limits may not be updated
1258                       for the command being run.  If pam_session,
1259                       pam_setcred, and use_pty are disabled and I/O logging
1260                       has not been configured, sudo will execute the command
1261                       directly instead of running it as a child process.
1262                       This flag is on by default.
1263
1264                       This setting is only supported by version 1.8.7 or
1265                       higher.
1266
1267     pam_setcred       On systems that use PAM for authentication, sudo will
1268                       attempt to establish credentials for the target user by
1269                       default, if supported by the underlying authentication
1270                       system.  One example of a credential is a Kerberos
1271                       ticket.  If pam_session, pam_setcred, and use_pty are
1272                       disabled and I/O logging has not been configured, sudo
1273                       will execute the command directly instead of running it
1274                       as a child process.  This flag is on by default.
1275
1276                       This setting is only supported by version 1.8.8 or
1277                       higher.
1278
1279     passprompt_override
1280                       If set, the prompt specified by passprompt or the
1281                       SUDO_PROMPT environment variable will always be used
1282                       and will replace the prompt provided by a PAM module or
1283                       other authentication method.  This flag is off by
1284                       default.
1285
1286     path_info         Normally, sudo will tell the user when a command could
1287                       not be found in their PATH environment variable.  Some
1288                       sites may wish to disable this as it could be used to
1289                       gather information on the location of executables that
1290                       the normal user does not have access to.  The disadvan‐
1291                       tage is that if the executable is simply not in the
1292                       user's PATH, sudo will tell the user that they are not
1293                       allowed to run it, which can be confusing.  This flag
1294                       is on by default.
1295
1296     preserve_groups   By default, sudo will initialize the group vector to
1297                       the list of groups the target user is in.  When
1298                       preserve_groups is set, the user's existing group vec‐
1299                       tor is left unaltered.  The real and effective group
1300                       IDs, however, are still set to match the target user.
1301                       This flag is off by default.
1302
1303     pwfeedback        By default, sudo reads the password like most other
1304                       Unix programs, by turning off echo until the user hits
1305                       the return (or enter) key.  Some users become confused
1306                       by this as it appears to them that sudo has hung at
1307                       this point.  When pwfeedback is set, sudo will provide
1308                       visual feedback when the user presses a key.  Note that
1309                       this does have a security impact as an onlooker may be
1310                       able to determine the length of the password being
1311                       entered.  This flag is off by default.
1312
1313     requiretty        If set, sudo will only run when the user is logged in
1314                       to a real tty.  When this flag is set, sudo can only be
1315                       run from a login session and not via other means such
1316                       as cron(8) or cgi-bin scripts.  This flag is off by
1317                       default.
1318
1319     root_sudo         If set, root is allowed to run sudo too.  Disabling
1320                       this prevents users from “chaining” sudo commands to
1321                       get a root shell by doing something like “sudo sudo
1322                       /bin/sh”.  Note, however, that turning off root_sudo
1323                       will also prevent root from running sudoedit.  Dis‐
1324                       abling root_sudo provides no real additional security;
1325                       it exists purely for historical reasons.  This flag is
1326                       on by default.
1327
1328     rootpw            If set, sudo will prompt for the root password instead
1329                       of the password of the invoking user when running a
1330                       command or editing a file.  This flag is off by
1331                       default.
1332
1333     runaspw           If set, sudo will prompt for the password of the user
1334                       defined by the runas_default option (defaults to root)
1335                       instead of the password of the invoking user when run‐
1336                       ning a command or editing a file.  This flag is off by
1337                       default.
1338
1339     set_home          If enabled and sudo is invoked with the -s option the
1340                       HOME environment variable will be set to the home
1341                       directory of the target user (which is root unless the
1342                       -u option is used).  This effectively makes the -s
1343                       option imply -H.  Note that HOME is already set when
1344                       the env_reset option is enabled, so set_home is only
1345                       effective for configurations where either env_reset is
1346                       disabled or HOME is present in the env_keep list.  This
1347                       flag is off by default.
1348
1349     set_logname       Normally, sudo will set the LOGNAME and USER environ‐
1350                       ment variables to the name of the target user (usually
1351                       root unless the -u option is given).  However, since
1352                       some programs (including the RCS revision control sys‐
1353                       tem) use LOGNAME to determine the real identity of the
1354                       user, it may be desirable to change this behavior.
1355                       This can be done by negating the set_logname option.
1356                       Note that set_logname will have no effect if the
1357                       env_reset option has not been disabled and the env_keep
1358                       list contains LOGNAME or USER.  This flag is on by
1359                       default.
1360
1361     set_utmp          When enabled, sudo will create an entry in the utmp (or
1362                       utmpx) file when a pseudo-tty is allocated.  A pseudo-
1363                       tty is allocated by sudo when the log_input, log_output
1364                       or use_pty flags are enabled.  By default, the new
1365                       entry will be a copy of the user's existing utmp entry
1366                       (if any), with the tty, time, type and pid fields
1367                       updated.  This flag is on by default.
1368
1369     setenv            Allow the user to disable the env_reset option from the
1370                       command line via the -E option.  Additionally, environ‐
1371                       ment variables set via the command line are not subject
1372                       to the restrictions imposed by env_check, env_delete,
1373                       or env_keep.  As such, only trusted users should be
1374                       allowed to set variables in this manner.  This flag is
1375                       off by default.
1376
1377     shell_noargs      If set and sudo is invoked with no arguments it acts as
1378                       if the -s option had been given.  That is, it runs a
1379                       shell as root (the shell is determined by the SHELL
1380                       environment variable if it is set, falling back on the
1381                       shell listed in the invoking user's /etc/passwd entry
1382                       if not).  This flag is off by default.
1383
1384     stay_setuid       Normally, when sudo executes a command the real and
1385                       effective UIDs are set to the target user (root by
1386                       default).  This option changes that behavior such that
1387                       the real UID is left as the invoking user's UID.  In
1388                       other words, this makes sudo act as a setuid wrapper.
1389                       This can be useful on systems that disable some poten‐
1390                       tially dangerous functionality when a program is run
1391                       setuid.  This option is only effective on systems that
1392                       support either the setreuid(2) or setresuid(2) system
1393                       call.  This flag is off by default.
1394
1395     sudoedit_checkdir
1396                       If set, sudoedit will check all directory components of
1397                       the path to be edited for writability by the invoking
1398                       user.  Symbolic links will not be followed in writable
1399                       directories and sudoedit will refuse to edit a file
1400                       located in a writable directory.  These restrictions
1401                       are not enforced when sudoedit is run by root.  On some
1402                       systems, if all directory components of the path to be
1403                       edited are not readable by the target user, sudoedit
1404                       will be unable to edit the file.  This flag is on by
1405                       default.
1406
1407                       This setting was first introduced in version 1.8.15 but
1408                       initially suffered from a race condition.  The check
1409                       for symbolic links in writable intermediate directories
1410                       was added in version 1.8.16.
1411
1412     sudoedit_follow   By default, sudoedit will not follow symbolic links
1413                       when opening files.  The sudoedit_follow option can be
1414                       enabled to allow sudoedit to open symbolic links.  It
1415                       may be overridden on a per-command basis by the FOLLOW
1416                       and NOFOLLOW tags.  This flag is off by default.
1417
1418                       This setting is only supported by version 1.8.15 or
1419                       higher.
1420
1421     syslog_pid        When logging via syslog(3), include the process ID in
1422                       the log entry.  This flag is off by default.
1423
1424                       This setting is only supported by version 1.8.21 or
1425                       higher.
1426
1427     targetpw          If set, sudo will prompt for the password of the user
1428                       specified by the -u option (defaults to root) instead
1429                       of the password of the invoking user when running a
1430                       command or editing a file.  Note that this flag pre‐
1431                       cludes the use of a uid not listed in the passwd data‐
1432                       base as an argument to the -u option.  This flag is off
1433                       by default.
1434
1435     tty_tickets       If set, users must authenticate on a per-tty basis.
1436                       With this flag enabled, sudo will use a separate record
1437                       in the time stamp file for each terminal.  If disabled,
1438                       a single record is used for all login sessions.
1439
1440                       This option has been superseded by the timestamp_type
1441                       option.
1442
1443     umask_override    If set, sudo will set the umask as specified in the
1444                       sudoers file without modification.  This makes it pos‐
1445                       sible to specify a umask in the sudoers file that is
1446                       more permissive than the user's own umask and matches
1447                       historical behavior.  If umask_override is not set,
1448                       sudo will set the umask to be the union of the user's
1449                       umask and what is specified in sudoers.  This flag is
1450                       off by default.
1451
1452     use_netgroups     If set, netgroups (prefixed with ‘+’), may be used in
1453                       place of a user or host.  For LDAP-based sudoers, net‐
1454                       group support requires an expensive sub-string match on
1455                       the server unless the NETGROUP_BASE directive is
1456                       present in the /etc/ldap.conf file.  If netgroups are
1457                       not needed, this option can be disabled to reduce the
1458                       load on the LDAP server.  This flag is on by default.
1459
1460     use_pty           If set, and sudo is running in a terminal, the command
1461                       will be run in a pseudo-pty (even if no I/O logging is
1462                       being done).  If the sudo process is not attached to a
1463                       terminal, use_pty has no effect.
1464
1465                       A malicious program run under sudo may be capable of
1466                       injecting commands into the user's terminal or running
1467                       a background process that retains access to the user's
1468                       terminal device even after the main program has fin‐
1469                       ished executing.  By running the command in a separate
1470                       pseudo-pty, this attack is no longer possible.  This
1471                       flag is off by default.
1472
1473     user_command_timeouts
1474                       If set, the user may specify a timeout on the command
1475                       line.  If the timeout expires before the command has
1476                       exited, the command will be terminated.  If a timeout
1477                       is specified both in the sudoers file and on the com‐
1478                       mand line, the smaller of the two timeouts will be
1479                       used.  See the Timeout_Spec section for a description
1480                       of the timeout syntax.  This flag is off by default.
1481
1482                       This setting is only supported by version 1.8.20 or
1483                       higher.
1484
1485     utmp_runas        If set, sudo will store the name of the runas user when
1486                       updating the utmp (or utmpx) file.  By default, sudo
1487                       stores the name of the invoking user.  This flag is off
1488                       by default.
1489
1490     visiblepw         By default, sudo will refuse to run if the user must
1491                       enter a password but it is not possible to disable echo
1492                       on the terminal.  If the visiblepw flag is set, sudo
1493                       will prompt for a password even when it would be visi‐
1494                       ble on the screen.  This makes it possible to run
1495                       things like “ssh somehost sudo ls” since by default,
1496                       ssh(1) does not allocate a tty when running a command.
1497                       This flag is off by default.
1498
1499     Integers:
1500
1501     closefrom         Before it executes a command, sudo will close all open
1502                       file descriptors other than standard input, standard
1503                       output and standard error (ie: file descriptors 0-2).
1504                       The closefrom option can be used to specify a different
1505                       file descriptor at which to start closing.  The default
1506                       is 3.
1507
1508     command_timeout   The maximum amount of time a command is allowed to run
1509                       before it is terminated.  See the Timeout_Spec section
1510                       for a description of the timeout syntax.
1511
1512                       This setting is only supported by version 1.8.20 or
1513                       higher.
1514
1515     maxseq            The maximum sequence number that will be substituted
1516                       for the “%{seq}” escape in the I/O log file (see the
1517                       iolog_dir description below for more information).
1518                       While the value substituted for “%{seq}” is in base 36,
1519                       maxseq itself should be expressed in decimal.  Values
1520                       larger than 2176782336 (which corresponds to the base
1521                       36 sequence number “ZZZZZZ”) will be silently truncated
1522                       to 2176782336.  The default value is 2176782336.
1523
1524                       Once the local sequence number reaches the value of
1525                       maxseq, it will “roll over” to zero, after which
1526                       sudoers will truncate and re-use any existing I/O log
1527                       path names.
1528
1529                       This setting is only supported by version 1.8.7 or
1530                       higher.
1531
1532     passwd_tries      The number of tries a user gets to enter his/her pass‐
1533                       word before sudo logs the failure and exits.  The
1534                       default is 3.
1535
1536     syslog_maxlen     On many systems, syslog(3) has a relatively small log
1537                       buffer.  IETF RFC 5424 states that syslog servers must
1538                       support messages of at least 480 bytes and should sup‐
1539                       port messages up to 2048 bytes.  By default, sudoers
1540                       creates log messages up to 980 bytes which corresponds
1541                       to the historic BSD syslog implementation which used a
1542                       1024 byte buffer to store the message, date, hostname
1543                       and program name.  To prevent syslog messages from
1544                       being truncated, sudoers will split up log messages
1545                       that are larger than syslog_maxlen bytes.  When a mes‐
1546                       sage is split, additional parts will include the string
1547                       “(command continued)” after the user name and before
1548                       the continued command line arguments.
1549
1550                       This setting is only supported by version 1.8.19 or
1551                       higher.
1552
1553     Integers that can be used in a boolean context:
1554
1555     loglinelen        Number of characters per line for the file log.  This
1556                       value is used to decide when to wrap lines for nicer
1557                       log files.  This has no effect on the syslog log file,
1558                       only the file log.  The default is 80 (use 0 or negate
1559                       the option to disable word wrap).
1560
1561     passwd_timeout    Number of minutes before the sudo password prompt times
1562                       out, or 0 for no timeout.  The timeout may include a
1563                       fractional component if minute granularity is insuffi‐
1564                       cient, for example 2.5.  The default is 5.
1565
1566     timestamp_timeout
1567                       Number of minutes that can elapse before sudo will ask
1568                       for a passwd again.  The timeout may include a frac‐
1569                       tional component if minute granularity is insufficient,
1570                       for example 2.5.  The default is 5.  Set this to 0 to
1571                       always prompt for a password.  If set to a value less
1572                       than 0 the user's time stamp will not expire until the
1573                       system is rebooted.  This can be used to allow users to
1574                       create or delete their own time stamps via “sudo -v”
1575                       and “sudo -k” respectively.
1576
1577     umask             Umask to use when running the command.  Negate this
1578                       option or set it to 0777 to preserve the user's umask.
1579                       The actual umask that is used will be the union of the
1580                       user's umask and the value of the umask option, which
1581                       defaults to 0022.  This guarantees that sudo never low‐
1582                       ers the umask when running a command.  Note: on systems
1583                       that use PAM, the default PAM configuration may specify
1584                       its own umask which will override the value set in
1585                       sudoers.
1586
1587     Strings:
1588
1589     authfail_message  Message that is displayed after a user fails to authen‐
1590                       ticate.  The message may include the ‘%d’ escape which
1591                       will expand to the number of failed password attempts.
1592                       If set, it overrides the default message, %d incorrect
1593                       password attempt(s).
1594
1595     badpass_message   Message that is displayed if a user enters an incorrect
1596                       password.  The default is Sorry, try again. unless
1597                       insults are enabled.
1598
1599     editor            A colon (‘:’) separated list of editors path names used
1600                       by sudoedit and visudo.  For sudoedit, this list is
1601                       used to find an editor when none of the SUDO_EDITOR,
1602                       VISUAL or EDITOR environment variables are set to an
1603                       editor that exists and is executable.  For visudo, it
1604                       is used as a white list of allowed editors; visudo will
1605                       choose the editor that matches the user's SUDO_EDITOR,
1606                       VISUAL or EDITOR environment variable if possible, or
1607                       the first editor in the list that exists and is exe‐
1608                       cutable if not.  Unless invoked as sudoedit, sudo does
1609                       not preserve the SUDO_EDITOR, VISUAL and EDITOR envi‐
1610                       ronment variables by default, even when the env_reset
1611                       option is enabled.  The default is /bin/vi.
1612
1613     iolog_dir         The top-level directory to use when constructing the
1614                       path name for the input/output log directory.  Only
1615                       used if the log_input or log_output options are enabled
1616                       or when the LOG_INPUT or LOG_OUTPUT tags are present
1617                       for a command.  The session sequence number, if any, is
1618                       stored in the directory.  The default is
1619                       /var/log/sudo-io.
1620
1621                       The following percent (‘%’) escape sequences are sup‐
1622                       ported:
1623
1624                       %{seq}
1625                             expanded to a monotonically increasing base-36
1626                             sequence number, such as 0100A5, where every two
1627                             digits are used to form a new directory, e.g.,
1628                             01/00/A5
1629
1630                       %{user}
1631                             expanded to the invoking user's login name
1632
1633                       %{group}
1634                             expanded to the name of the invoking user's real
1635                             group ID
1636
1637                       %{runas_user}
1638                             expanded to the login name of the user the com‐
1639                             mand will be run as (e.g., root)
1640
1641                       %{runas_group}
1642                             expanded to the group name of the user the com‐
1643                             mand will be run as (e.g., wheel)
1644
1645                       %{hostname}
1646                             expanded to the local host name without the
1647                             domain name
1648
1649                       %{command}
1650                             expanded to the base name of the command being
1651                             run
1652
1653                       In addition, any escape sequences supported by the sys‐
1654                       tem's strftime(3) function will be expanded.
1655
1656                       To include a literal ‘%’ character, the string ‘%%’
1657                       should be used.
1658
1659     iolog_file        The path name, relative to iolog_dir, in which to store
1660                       input/output logs when the log_input or log_output
1661                       options are enabled or when the LOG_INPUT or LOG_OUTPUT
1662                       tags are present for a command.  Note that iolog_file
1663                       may contain directory components.  The default is
1664                       “%{seq}”.
1665
1666                       See the iolog_dir option above for a list of supported
1667                       percent (‘%’) escape sequences.
1668
1669                       In addition to the escape sequences, path names that
1670                       end in six or more Xs will have the Xs replaced with a
1671                       unique combination of digits and letters, similar to
1672                       the mktemp(3) function.
1673
1674                       If the path created by concatenating iolog_dir and
1675                       iolog_file already exists, the existing I/O log file
1676                       will be truncated and overwritten unless iolog_file
1677                       ends in six or more Xs.
1678
1679     iolog_flush       If set, sudo will flush I/O log data to disk after each
1680                       write instead of buffering it.  This makes it possible
1681                       to view the logs in real-time as the program is execut‐
1682                       ing but may significantly reduce the effectiveness of
1683                       I/O log compression.  This flag is off by default.
1684
1685                       This setting is only supported by version 1.8.20 or
1686                       higher.
1687
1688     iolog_group       The group name to look up when setting the group ID on
1689                       new I/O log files and directories.  If iolog_group is
1690                       not set, the primary group ID of the user specified by
1691                       iolog_user is used.  If neither iolog_group nor
1692                       iolog_user are set, I/O log files and directories are
1693                       created with group ID 0.
1694
1695                       This setting is only supported by version 1.8.19 or
1696                       higher.
1697
1698     iolog_mode        The file mode to use when creating I/O log files.  Mode
1699                       bits for read and write permissions for owner, group or
1700                       other are honored, everything else is ignored.  The
1701                       file permissions will always include the owner read and
1702                       write bits, even if they are not present in the speci‐
1703                       fied mode.  When creating I/O log directories, search
1704                       (execute) bits are added to match the read and write
1705                       bits specified by iolog_mode.  Defaults to 0600 (read
1706                       and write by user only).
1707
1708                       This setting is only supported by version 1.8.19 or
1709                       higher.
1710
1711     iolog_user        The user name to look up when setting the user and
1712                       group IDs on new I/O log files and directories.  If
1713                       iolog_group is set, it will be used instead of the
1714                       user's primary group ID.  By default, I/O log files and
1715                       directories are created with user and group ID 0.
1716
1717                       This setting can be useful when the I/O logs are stored
1718                       on a Network File System (NFS) share.  Having a dedi‐
1719                       cated user own the I/O log files means that sudoers
1720                       does not write to the log files as user ID 0, which is
1721                       usually not permitted by NFS.
1722
1723                       This setting is only supported by version 1.8.19 or
1724                       higher.
1725
1726     lecture_status_dir
1727                       The directory in which sudo stores per-user lecture
1728                       status files.  Once a user has received the lecture, a
1729                       zero-length file is created in this directory so that
1730                       sudo will not lecture the user again.  This directory
1731                       should not be cleared when the system reboots.  The
1732                       default is /var/db/sudo/lectured.
1733
1734     mailsub           Subject of the mail sent to the mailto user.  The
1735                       escape %h will expand to the host name of the machine.
1736                       Default is “*** SECURITY information for %h ***”.
1737
1738     noexec_file       As of sudo version 1.8.1 this option is no longer sup‐
1739                       ported.  The path to the noexec file should now be set
1740                       in the sudo.conf(5) file.
1741
1742     pam_login_service
1743                       On systems that use PAM for authentication, this is the
1744                       service name used when the -i option is specified.  The
1745                       default value is “sudo-i”.  See the description of
1746                       pam_service for more information.
1747
1748                       This setting is only supported by version 1.8.8 or
1749                       higher.
1750
1751     pam_service       On systems that use PAM for authentication, the service
1752                       name specifies the PAM policy to apply.  This usually
1753                       corresponds to an entry in the pam.conf file or a file
1754                       in the /etc/pam.d directory.  The default value is
1755                       “sudo”.
1756
1757                       This setting is only supported by version 1.8.8 or
1758                       higher.
1759
1760     passprompt        The default prompt to use when asking for a password;
1761                       can be overridden via the -p option or the SUDO_PROMPT
1762                       environment variable.  The following percent (‘%’)
1763                       escape sequences are supported:
1764
1765                       %H    expanded to the local host name including the
1766                             domain name (only if the machine's host name is
1767                             fully qualified or the fqdn option is set)
1768
1769                       %h    expanded to the local host name without the
1770                             domain name
1771
1772                       %p    expanded to the user whose password is being
1773                             asked for (respects the rootpw, targetpw and
1774                             runaspw flags in sudoers)
1775
1776                       %U    expanded to the login name of the user the com‐
1777                             mand will be run as (defaults to root)
1778
1779                       %u    expanded to the invoking user's login name
1780
1781                       %%    two consecutive % characters are collapsed into a
1782                             single % character
1783
1784                       On systems that use PAM for authentication, passprompt
1785                       will only be used if the prompt provided by the PAM
1786                       module matches the string “Password: ” or “username's
1787                       Password: ”.  This ensures that the passprompt setting
1788                       does not interfere with challenge-response style
1789                       authentication.  The passprompt_override flag can be
1790                       used to change this behavior.
1791
1792                       The default value is “[sudo] password for %p: ”.
1793
1794     role              The default SELinux role to use when constructing a new
1795                       security context to run the command.  The default role
1796                       may be overridden on a per-command basis in the sudoers
1797                       file or via command line options.  This option is only
1798                       available when sudo is built with SELinux support.
1799
1800     runas_default     The default user to run commands as if the -u option is
1801                       not specified on the command line.  This defaults to
1802                       root.
1803
1804     sudoers_locale    Locale to use when parsing the sudoers file, logging
1805                       commands, and sending email.  Note that changing the
1806                       locale may affect how sudoers is interpreted.  Defaults
1807                       to “C”.
1808
1809     timestamp_type    sudoers uses per-user time stamp files for credential
1810                       caching.  The timestamp_type option can be used to
1811                       specify the type of time stamp record used.  It has the
1812                       following possible values:
1813
1814                       global  A single time stamp record is used for all of a
1815                               user's login sessions, regardless of the termi‐
1816                               nal or parent process ID.  An additional record
1817                               is used to serialize password prompts when sudo
1818                               is used multiple times in a pipeline, but this
1819                               does not affect authentication.
1820
1821                       ppid    A single time stamp record is used for all pro‐
1822                               cesses with the same parent process ID (usually
1823                               the shell).  Commands run from the same shell
1824                               (or other common parent process) will not
1825                               require a password for timestamp_timeout min‐
1826                               utes (5 by default).  Commands run via sudo
1827                               with a different parent process ID, for example
1828                               from a shell script, will be authenticated sep‐
1829                               arately.
1830
1831                       tty     One time stamp record is used for each termi‐
1832                               nal, which means that a user's login sessions
1833                               are authenticated separately.  If no terminal
1834                               is present, the behavior is the same as ppid.
1835                               Commands run from the same terminal will not
1836                               require a password for timestamp_timeout min‐
1837                               utes (5 by default).
1838
1839                       kernel  The time stamp is stored in the kernel as an
1840                               attribute of the terminal device.  If no termi‐
1841                               nal is present, the behavior is the same as
1842                               ppid.  Negative timestamp_timeout values are
1843                               not supported and positive values are limited
1844                               to a maximum of 60 minutes.  This is currently
1845                               only supported on OpenBSD.
1846
1847                       The default value is tty.
1848
1849                       This setting is only supported by version 1.8.21 or
1850                       higher.
1851
1852     timestampdir      The directory in which sudo stores its time stamp
1853                       files.  This directory should be cleared when the sys‐
1854                       tem reboots.  The default is /run/sudo/ts.
1855
1856     timestampowner    The owner of the lecture status directory, time stamp
1857                       directory and all files stored therein.  The default is
1858                       root.
1859
1860     type              The default SELinux type to use when constructing a new
1861                       security context to run the command.  The default type
1862                       may be overridden on a per-command basis in the sudoers
1863                       file or via command line options.  This option is only
1864                       available when sudo is built with SELinux support.
1865
1866     Strings that can be used in a boolean context:
1867
1868     env_file      The env_file option specifies the fully qualified path to a
1869                   file containing variables to be set in the environment of
1870                   the program being run.  Entries in this file should either
1871                   be of the form “VARIABLE=value” or “export VARIABLE=value”.
1872                   The value may optionally be surrounded by single or double
1873                   quotes.  Variables in this file are only added if the vari‐
1874                   able does not already exist in the environment.  This file
1875                   is considered to be part of the security policy, its con‐
1876                   tents are not subject to other sudo environment restric‐
1877                   tions such as env_keep and env_check.
1878
1879     exempt_group  Users in this group are exempt from password and PATH
1880                   requirements.  The group name specified should not include
1881                   a % prefix.  This is not set by default.
1882
1883     fdexec        Determines whether sudo will execute a command by its path
1884                   or by an open file descriptor.  It has the following possi‐
1885                   ble values:
1886
1887                   always  Always execute by file descriptor.
1888
1889                   never   Never execute by file descriptor.
1890
1891                   digest_only
1892                           Only execute by file descriptor if the command has
1893                           an associated digest in the sudoers file.
1894
1895                   The default value is digest_only.  This avoids a time of
1896                   check versus time of use race condition when the command is
1897                   located in a directory writable by the invoking user.
1898
1899                   Note that fdexec will change the first element of the argu‐
1900                   ment vector for scripts ($0 in the shell) due to the way
1901                   the kernel runs script interpreters.  Instead of being a
1902                   normal path, it will refer to a file descriptor.  For exam‐
1903                   ple, /dev/fd/4 on Solaris and /proc/self/fd/4 on Linux.  A
1904                   workaround is to use the SUDO_COMMAND environment variable
1905                   instead.
1906
1907                   The fdexec setting is only used when the command is matched
1908                   by path name.  It has no effect if the command is matched
1909                   by the built-in ALL alias.
1910
1911                   This setting is only supported by version 1.8.20 or higher.
1912                   If the operating system does not support the fexecve(2)
1913                   system call, this setting has no effect.
1914
1915     group_plugin  A string containing a sudoers group plugin with optional
1916                   arguments.  The string should consist of the plugin path,
1917                   either fully-qualified or relative to the /usr/libexec/sudo
1918                   directory, followed by any configuration arguments the
1919                   plugin requires.  These arguments (if any) will be passed
1920                   to the plugin's initialization function.  If arguments are
1921                   present, the string must be enclosed in double quotes ("").
1922
1923                   For more information see GROUP PROVIDER PLUGINS.
1924
1925     lecture       This option controls when a short lecture will be printed
1926                   along with the password prompt.  It has the following pos‐
1927                   sible values:
1928
1929                   always  Always lecture the user.
1930
1931                   never   Never lecture the user.
1932
1933                   once    Only lecture the user the first time they run sudo.
1934
1935                   If no value is specified, a value of once is implied.
1936                   Negating the option results in a value of never being used.
1937                   The default value is once.
1938
1939     lecture_file  Path to a file containing an alternate sudo lecture that
1940                   will be used in place of the standard lecture if the named
1941                   file exists.  By default, sudo uses a built-in lecture.
1942
1943     listpw        This option controls when a password will be required when
1944                   a user runs sudo with the -l option.  It has the following
1945                   possible values:
1946
1947                   all       All the user's sudoers file entries for the cur‐
1948                             rent host must have the NOPASSWD flag set to
1949                             avoid entering a password.
1950
1951                   always    The user must always enter a password to use the
1952                             -l option.
1953
1954                   any       At least one of the user's sudoers file entries
1955                             for the current host must have the NOPASSWD flag
1956                             set to avoid entering a password.
1957
1958                   never     The user need never enter a password to use the
1959                             -l option.
1960
1961                   If no value is specified, a value of any is implied.
1962                   Negating the option results in a value of never being used.
1963                   The default value is any.
1964
1965     logfile       Path to the sudo log file (not the syslog log file).  Set‐
1966                   ting a path turns on logging to a file; negating this
1967                   option turns it off.  By default, sudo logs via syslog.
1968
1969     mailerflags   Flags to use when invoking mailer.  Defaults to -t.
1970
1971     mailerpath    Path to mail program used to send warning mail.  Defaults
1972                   to the path to sendmail found at configure time.
1973
1974     mailfrom      Address to use for the “from” address when sending warning
1975                   and error mail.  The address should be enclosed in double
1976                   quotes ("") to protect against sudo interpreting the @
1977                   sign.  Defaults to the name of the user running sudo.
1978
1979     mailto        Address to send warning and error mail to.  The address
1980                   should be enclosed in double quotes ("") to protect against
1981                   sudo interpreting the @ sign.  Defaults to root.
1982
1983     restricted_env_file
1984                   The restricted_env_file option specifies the fully quali‐
1985                   fied path to a file containing variables to be set in the
1986                   environment of the program being run.  Entries in this file
1987                   should either be of the form “VARIABLE=value” or “export
1988                   VARIABLE=value”.  The value may optionally be surrounded by
1989                   single or double quotes.  Variables in this file are only
1990                   added if the variable does not already exist in the envi‐
1991                   ronment.  Unlike env_file, the file's contents are not
1992                   trusted and are processed in a manner similar to that of
1993                   the invoking user's environment.  If env_reset is enabled,
1994                   variables in the file will only be added if they are
1995                   matched by either the env_check or env_keep list.  If
1996                   env_reset is disabled, variables in the file are added as
1997                   long as they are not matched by the env_delete list.  In
1998                   either case, the contents of restricted_env_file are pro‐
1999                   cessed before the contents of env_file.
2000
2001     secure_path   Path used for every command run from sudo.  If you don't
2002                   trust the people running sudo to have a sane PATH environ‐
2003                   ment variable you may want to use this.  Another use is if
2004                   you want to have the “root path” be separate from the “user
2005                   path”.  Users in the group specified by the exempt_group
2006                   option are not affected by secure_path.  This option is not
2007                   set by default.
2008
2009     syslog        Syslog facility if syslog is being used for logging (negate
2010                   to disable syslog logging).  Defaults to authpriv.
2011
2012                   The following syslog facilities are supported: authpriv (if
2013                   your OS supports it), auth, daemon, user, local0, local1,
2014                   local2, local3, local4, local5, local6, and local7.
2015
2016     syslog_badpri
2017                   Syslog priority to use when the user is not allowed to run
2018                   a command or when authentication is unsuccessful.  Defaults
2019                   to alert.
2020
2021                   The following syslog priorities are supported: alert, crit,
2022                   debug, emerg, err, info, notice, warning, and none.  Negat‐
2023                   ing the option or setting it to a value of none will dis‐
2024                   able logging of unsuccessful commands.
2025
2026     syslog_goodpri
2027                   Syslog priority to use when the user is allowed to run a
2028                   command and authentication is successful.  Defaults to
2029                   notice.
2030
2031                   See syslog_badpri for the list of supported syslog priori‐
2032                   ties.  Negating the option or setting it to a value of none
2033                   will disable logging of successful commands.
2034
2035     verifypw      This option controls when a password will be required when
2036                   a user runs sudo with the -v option.  It has the following
2037                   possible values:
2038
2039                   all     All the user's sudoers file entries for the current
2040                           host must have the NOPASSWD flag set to avoid
2041                           entering a password.
2042
2043                   always  The user must always enter a password to use the -v
2044                           option.
2045
2046                   any     At least one of the user's sudoers file entries for
2047                           the current host must have the NOPASSWD flag set to
2048                           avoid entering a password.
2049
2050                   never   The user need never enter a password to use the -v
2051                           option.
2052
2053                   If no value is specified, a value of all is implied.
2054                   Negating the option results in a value of never being used.
2055                   The default value is all.
2056
2057     Lists that can be used in a boolean context:
2058
2059     env_check         Environment variables to be removed from the user's
2060                       environment unless they are considered “safe”.  For all
2061                       variables except TZ, “safe” means that the variable's
2062                       value does not contain any ‘%’ or ‘/’ characters.  This
2063                       can be used to guard against printf-style format vul‐
2064                       nerabilities in poorly-written programs.  The TZ vari‐
2065                       able is considered unsafe if any of the following are
2066                       true:
2067
2068                       ·  It consists of a fully-qualified path name, option‐
2069                          ally prefixed with a colon (‘:’), that does not
2070                          match the location of the zoneinfo directory.
2071
2072                       ·  It contains a .. path element.
2073
2074                       ·  It contains white space or non-printable characters.
2075
2076                       ·  It is longer than the value of PATH_MAX.
2077
2078                       The argument may be a double-quoted, space-separated
2079                       list or a single value without double-quotes.  The list
2080                       can be replaced, added to, deleted from, or disabled by
2081                       using the =, +=, -=, and ! operators respectively.
2082                       Regardless of whether the env_reset option is enabled
2083                       or disabled, variables specified by env_check will be
2084                       preserved in the environment if they pass the aforemen‐
2085                       tioned check.  The global list of environment variables
2086                       to check is displayed when sudo is run by root with the
2087                       -V option.
2088
2089     env_delete        Environment variables to be removed from the user's
2090                       environment when the env_reset option is not in effect.
2091                       The argument may be a double-quoted, space-separated
2092                       list or a single value without double-quotes.  The list
2093                       can be replaced, added to, deleted from, or disabled by
2094                       using the =, +=, -=, and ! operators respectively.  The
2095                       global list of environment variables to remove is dis‐
2096                       played when sudo is run by root with the -V option.
2097                       Note that many operating systems will remove poten‐
2098                       tially dangerous variables from the environment of any
2099                       setuid process (such as sudo).
2100
2101     env_keep          Environment variables to be preserved in the user's
2102                       environment when the env_reset option is in effect.
2103                       This allows fine-grained control over the environment
2104                       sudo-spawned processes will receive.  The argument may
2105                       be a double-quoted, space-separated list or a single
2106                       value without double-quotes.  The list can be replaced,
2107                       added to, deleted from, or disabled by using the =, +=,
2108                       -=, and ! operators respectively.  The global list of
2109                       variables to keep is displayed when sudo is run by root
2110                       with the -V option.
2111

GROUP PROVIDER PLUGINS

2113     The sudoers plugin supports its own plugin interface to allow non-Unix
2114     group lookups which can query a group source other than the standard Unix
2115     group database.  This can be used to implement support for the
2116     nonunix_group syntax described earlier.
2117
2118     Group provider plugins are specified via the group_plugin Defaults set‐
2119     ting.  The argument to group_plugin should consist of the plugin path,
2120     either fully-qualified or relative to the /usr/libexec/sudo directory,
2121     followed by any configuration options the plugin requires.  These options
2122     (if specified) will be passed to the plugin's initialization function.
2123     If options are present, the string must be enclosed in double quotes
2124     ("").
2125
2126     The following group provider plugins are installed by default:
2127
2128     group_file
2129               The group_file plugin supports an alternate group file that
2130               uses the same syntax as the /etc/group file.  The path to the
2131               group file should be specified as an option to the plugin.  For
2132               example, if the group file to be used is /etc/sudo-group:
2133
2134               Defaults group_plugin="group_file.so /etc/sudo-group"
2135
2136     system_group
2137               The system_group plugin supports group lookups via the standard
2138               C library functions getgrnam() and getgrid().  This plugin can
2139               be used in instances where the user belongs to groups not
2140               present in the user's supplemental group vector.  This plugin
2141               takes no options:
2142
2143               Defaults group_plugin=system_group.so
2144
2145     The group provider plugin API is described in detail in sudo_plugin(5).
2146

LOG FORMAT

2148     sudoers can log events using either syslog(3) or a simple log file.  The
2149     log format is almost identical in both cases.
2150
2151   Accepted command log entries
2152     Commands that sudo runs are logged using the following format (split into
2153     multiple lines for readability):
2154
2155         date hostname progname: username : TTY=ttyname ; PWD=cwd ; \
2156             USER=runasuser ; GROUP=runasgroup ; TSID=logid ; \
2157             ENV=env_vars COMMAND=command
2158
2159     Where the fields are as follows:
2160
2161     date          The date the command was run.  Typically, this is in the
2162                   format “MMM, DD, HH:MM:SS”.  If logging via syslog(3), the
2163                   actual date format is controlled by the syslog daemon.  If
2164                   logging to a file and the log_year option is enabled, the
2165                   date will also include the year.
2166
2167     hostname      The name of the host sudo was run on.  This field is only
2168                   present when logging via syslog(3).
2169
2170     progname      The name of the program, usually sudo or sudoedit.  This
2171                   field is only present when logging via syslog(3).
2172
2173     username      The login name of the user who ran sudo.
2174
2175     ttyname       The short name of the terminal (e.g., “console”, “tty01”,
2176                   or “pts/0”) sudo was run on, or “unknown” if there was no
2177                   terminal present.
2178
2179     cwd           The current working directory that sudo was run in.
2180
2181     runasuser     The user the command was run as.
2182
2183     runasgroup    The group the command was run as if one was specified on
2184                   the command line.
2185
2186     logid         An I/O log identifier that can be used to replay the com‐
2187                   mand's output.  This is only present when the log_input or
2188                   log_output option is enabled.
2189
2190     env_vars      A list of environment variables specified on the command
2191                   line, if specified.
2192
2193     command       The actual command that was executed.
2194
2195     Messages are logged using the locale specified by sudoers_locale, which
2196     defaults to the “C” locale.
2197
2198   Denied command log entries
2199     If the user is not allowed to run the command, the reason for the denial
2200     will follow the user name.  Possible reasons include:
2201
2202     user NOT in sudoers
2203       The user is not listed in the sudoers file.
2204
2205     user NOT authorized on host
2206       The user is listed in the sudoers file but is not allowed to run com‐
2207       mands on the host.
2208
2209     command not allowed
2210       The user is listed in the sudoers file for the host but they are not
2211       allowed to run the specified command.
2212
2213     3 incorrect password attempts
2214       The user failed to enter their password after 3 tries.  The actual num‐
2215       ber of tries will vary based on the number of failed attempts and the
2216       value of the passwd_tries option.
2217
2218     a password is required
2219       sudo's -n option was specified but a password was required.
2220
2221     sorry, you are not allowed to set the following environment variables
2222       The user specified environment variables on the command line that were
2223       not allowed by sudoers.
2224
2225   Error log entries
2226     If an error occurs, sudoers will log a message and, in most cases, send a
2227     message to the administrator via email.  Possible errors include:
2228
2229     parse error in /etc/sudoers near line N
2230       sudoers encountered an error when parsing the specified file.  In some
2231       cases, the actual error may be one line above or below the line number
2232       listed, depending on the type of error.
2233
2234     problem with defaults entries
2235       The sudoers file contains one or more unknown Defaults settings.  This
2236       does not prevent sudo from running, but the sudoers file should be
2237       checked using visudo.
2238
2239     timestamp owner (username): No such user
2240       The time stamp directory owner, as specified by the timestampowner set‐
2241       ting, could not be found in the password database.
2242
2243     unable to open/read /etc/sudoers
2244       The sudoers file could not be opened for reading.  This can happen when
2245       the sudoers file is located on a remote file system that maps user ID 0
2246       to a different value.  Normally, sudoers tries to open the sudoers file
2247       using group permissions to avoid this problem.  Consider either chang‐
2248       ing the ownership of /etc/sudoers or adding an argument like
2249       “sudoers_uid=N” (where ‘N’ is the user ID that owns the sudoers file)
2250       to the end of the sudoers Plugin line in the sudo.conf(5) file.
2251
2252     unable to stat /etc/sudoers
2253       The /etc/sudoers file is missing.
2254
2255     /etc/sudoers is not a regular file
2256       The /etc/sudoers file exists but is not a regular file or symbolic
2257       link.
2258
2259     /etc/sudoers is owned by uid N, should be 0
2260       The sudoers file has the wrong owner.  If you wish to change the
2261       sudoers file owner, please add “sudoers_uid=N” (where ‘N’ is the user
2262       ID that owns the sudoers file) to the sudoers Plugin line in the
2263       sudo.conf(5) file.
2264
2265     /etc/sudoers is world writable
2266       The permissions on the sudoers file allow all users to write to it.
2267       The sudoers file must not be world-writable, the default file mode is
2268       0440 (readable by owner and group, writable by none).  The default mode
2269       may be changed via the “sudoers_mode” option to the sudoers Plugin line
2270       in the sudo.conf(5) file.
2271
2272     /etc/sudoers is owned by gid N, should be 1
2273       The sudoers file has the wrong group ownership.  If you wish to change
2274       the sudoers file group ownership, please add “sudoers_gid=N” (where ‘N’
2275       is the group ID that owns the sudoers file) to the sudoers Plugin line
2276       in the sudo.conf(5) file.
2277
2278     unable to open /run/sudo/ts/username
2279       sudoers was unable to read or create the user's time stamp file.  This
2280       can happen when timestampowner is set to a user other than root and the
2281       mode on /run/sudo is not searchable by group or other.  The default
2282       mode for /run/sudo is 0711.
2283
2284     unable to write to /run/sudo/ts/username
2285       sudoers was unable to write to the user's time stamp file.
2286
2287     /run/sudo/ts is owned by uid X, should be Y
2288       The time stamp directory is owned by a user other than timestampowner.
2289       This can occur when the value of timestampowner has been changed.
2290       sudoers will ignore the time stamp directory until the owner is cor‐
2291       rected.
2292
2293     /run/sudo/ts is group writable
2294       The time stamp directory is group-writable; it should be writable only
2295       by timestampowner.  The default mode for the time stamp directory is
2296       0700.  sudoers will ignore the time stamp directory until the mode is
2297       corrected.
2298
2299   Notes on logging via syslog
2300     By default, sudoers logs messages via syslog(3).  The date, hostname, and
2301     progname fields are added by the system's syslog() function, not sudoers
2302     itself.  As such, they may vary in format on different systems.
2303
2304     The maximum size of syslog messages varies from system to system.  The
2305     syslog_maxlen setting can be used to change the maximum syslog message
2306     size from the default value of 980 bytes.  For more information, see the
2307     description of syslog_maxlen.
2308
2309   Notes on logging to a file
2310     If the logfile option is set, sudoers will log to a local file, such as
2311     /var/log/sudo.  When logging to a file, sudoers uses a format similar to
2312     syslog(3), with a few important differences:
2313
2314     1.   The progname and hostname fields are not present.
2315
2316     2.   If the log_year option is enabled, the date will also include the
2317          year.
2318
2319     3.   Lines that are longer than loglinelen characters (80 by default) are
2320          word-wrapped and continued on the next line with a four character
2321          indent.  This makes entries easier to read for a human being, but
2322          makes it more difficult to use grep(1) on the log files.  If the
2323          loglinelen option is set to 0 (or negated with a ‘!’), word wrap
2324          will be disabled.
2325

I/O LOG FILES

2327     When I/O logging is enabled, sudo will run the command in a pseudo-tty
2328     and log all user input and/or output, depending on which options are
2329     enabled.  I/O is logged to the directory specified by the iolog_dir
2330     option (/var/log/sudo-io by default) using a unique session ID that is
2331     included in the sudo log line, prefixed with “TSID=”.  The iolog_file
2332     option may be used to control the format of the session ID.
2333
2334     Each I/O log is stored in a separate directory that contains the follow‐
2335     ing files:
2336
2337     log       a text file containing the time the command was run, the name
2338               of the user who ran sudo, the name of the target user, the name
2339               of the target group (optional), the terminal that sudo was run
2340               from, the number of rows and columns of the terminal, the work‐
2341               ing directory the command was run from and the path name of the
2342               command itself (with arguments if present)
2343
2344     timing    a log of the amount of time between, and the number of bytes
2345               in, each I/O log entry (used for session playback)
2346
2347     ttyin     input from the user's tty (what the user types)
2348
2349     stdin     input from a pipe or file
2350
2351     ttyout    output from the pseudo-tty (what the command writes to the
2352               screen)
2353
2354     stdout    standard output to a pipe or redirected to a file
2355
2356     stderr    standard error to a pipe or redirected to a file
2357
2358     All files other than log are compressed in gzip format unless the
2359     compress_io flag has been disabled.  Due to buffering, it is not normally
2360     possible to display the I/O logs in real-time as the program is executing
2361     The I/O log data will not be complete until the program run by sudo has
2362     exited or has been terminated by a signal.  The iolog_flush flag can be
2363     used to disable buffering, in which case I/O log data is written to disk
2364     as soon as it is available.  The output portion of an I/O log file can be
2365     viewed with the sudoreplay(8) utility, which can also be used to list or
2366     search the available logs.
2367
2368     Note that user input may contain sensitive information such as passwords
2369     (even if they are not echoed to the screen), which will be stored in the
2370     log file unencrypted.  In most cases, logging the command output via
2371     log_output or LOG_OUTPUT is all that is required.
2372
2373     Since each session's I/O logs are stored in a separate directory, tradi‐
2374     tional log rotation utilities cannot be used to limit the number of I/O
2375     logs.  The simplest way to limit the number of I/O is by setting the
2376     maxseq option to the maximum number of logs you wish to store.  Once the
2377     I/O log sequence number reaches maxseq, it will be reset to zero and
2378     sudoers will truncate and re-use any existing I/O logs.
2379

FILES

2381     /etc/sudo.conf            Sudo front end configuration
2382
2383     /etc/sudoers              List of who can run what
2384
2385     /etc/group                Local groups file
2386
2387     /etc/netgroup             List of network groups
2388
2389     /var/log/sudo-io          I/O log files
2390
2391     /run/sudo/ts              Directory containing time stamps for the
2392                               sudoers security policy
2393
2394     /var/db/sudo/lectured     Directory containing lecture status files for
2395                               the sudoers security policy
2396
2397     /etc/environment          Initial environment for -i mode on AIX and
2398                               Linux systems
2399

EXAMPLES

2401     Below are example sudoers file entries.  Admittedly, some of these are a
2402     bit contrived.  First, we allow a few environment variables to pass and
2403     then define our aliases:
2404
2405     # Run X applications through sudo; HOME is used to find the
2406     # .Xauthority file.  Note that other programs use HOME to find
2407     # configuration files and this may lead to privilege escalation!
2408     Defaults env_keep += "DISPLAY HOME"
2409
2410     # User alias specification
2411     User_Alias      FULLTIMERS = millert, mikef, dowdy
2412     User_Alias      PARTTIMERS = bostley, jwfox, crawl
2413     User_Alias      WEBMASTERS = will, wendy, wim
2414
2415     # Runas alias specification
2416     Runas_Alias     OP = root, operator
2417     Runas_Alias     DB = oracle, sybase
2418     Runas_Alias     ADMINGRP = adm, oper
2419
2420     # Host alias specification
2421     Host_Alias      SPARC = bigtime, eclipse, moet, anchor :\
2422                     SGI = grolsch, dandelion, black :\
2423                     ALPHA = widget, thalamus, foobar :\
2424                     HPPA = boa, nag, python
2425     Host_Alias      CUNETS = 128.138.0.0/255.255.0.0
2426     Host_Alias      CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
2427     Host_Alias      SERVERS = master, mail, www, ns
2428     Host_Alias      CDROM = orion, perseus, hercules
2429
2430     # Cmnd alias specification
2431     Cmnd_Alias      DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\
2432                             /usr/sbin/restore, /usr/sbin/rrestore,\
2433                             sha224:0GomF8mNN3wlDt1HD9XldjJ3SNgpFdbjO1+NsQ== \
2434                             /home/operator/bin/start_backups
2435     Cmnd_Alias      KILL = /usr/bin/kill
2436     Cmnd_Alias      PRINTING = /usr/sbin/lpc, /usr/bin/lprm
2437     Cmnd_Alias      SHUTDOWN = /usr/sbin/shutdown
2438     Cmnd_Alias      HALT = /usr/sbin/halt
2439     Cmnd_Alias      REBOOT = /usr/sbin/reboot
2440     Cmnd_Alias      SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh,\
2441                              /usr/local/bin/tcsh, /usr/bin/rsh,\
2442                              /usr/local/bin/zsh
2443     Cmnd_Alias      SU = /usr/bin/su
2444     Cmnd_Alias      PAGERS = /usr/bin/more, /usr/bin/pg, /usr/bin/less
2445
2446     Here we override some of the compiled in default values.  We want sudo to
2447     log via syslog(3) using the auth facility in all cases.  We don't want to
2448     subject the full time staff to the sudo lecture, user millert need not
2449     give a password, and we don't want to reset the LOGNAME or USER environ‐
2450     ment variables when running commands as root.  Additionally, on the
2451     machines in the SERVERS Host_Alias, we keep an additional local log file
2452     and make sure we log the year in each log line since the log entries will
2453     be kept around for several years.  Lastly, we disable shell escapes for
2454     the commands in the PAGERS Cmnd_Alias (/usr/bin/more, /usr/bin/pg and
2455     /usr/bin/less).  Note that this will not effectively constrain users with
2456     sudo ALL privileges.
2457
2458     # Override built-in defaults
2459     Defaults                syslog=auth
2460     Defaults>root           !set_logname
2461     Defaults:FULLTIMERS     !lecture
2462     Defaults:millert        !authenticate
2463     Defaults@SERVERS        log_year, logfile=/var/log/sudo.log
2464     Defaults!PAGERS         noexec
2465
2466     The User specification is the part that actually determines who may run
2467     what.
2468
2469     root            ALL = (ALL) ALL
2470     %wheel          ALL = (ALL) ALL
2471
2472     We let root and any user in group wheel run any command on any host as
2473     any user.
2474
2475     FULLTIMERS      ALL = NOPASSWD: ALL
2476
2477     Full time sysadmins (millert, mikef, and dowdy) may run any command on
2478     any host without authenticating themselves.
2479
2480     PARTTIMERS      ALL = ALL
2481
2482     Part time sysadmins bostley, jwfox, and crawl) may run any command on any
2483     host but they must authenticate themselves first (since the entry lacks
2484     the NOPASSWD tag).
2485
2486     jack            CSNETS = ALL
2487
2488     The user jack may run any command on the machines in the CSNETS alias
2489     (the networks 128.138.243.0, 128.138.204.0, and 128.138.242.0).  Of those
2490     networks, only 128.138.204.0 has an explicit netmask (in CIDR notation)
2491     indicating it is a class C network.  For the other networks in CSNETS,
2492     the local machine's netmask will be used during matching.
2493
2494     lisa            CUNETS = ALL
2495
2496     The user lisa may run any command on any host in the CUNETS alias (the
2497     class B network 128.138.0.0).
2498
2499     operator        ALL = DUMPS, KILL, SHUTDOWN, HALT, REBOOT, PRINTING,\
2500                     sudoedit /etc/printcap, /usr/oper/bin/
2501
2502     The operator user may run commands limited to simple maintenance.  Here,
2503     those are commands related to backups, killing processes, the printing
2504     system, shutting down the system, and any commands in the directory
2505     /usr/oper/bin/.  Note that one command in the DUMPS Cmnd_Alias includes a
2506     sha224 digest, /home/operator/bin/start_backups.  This is because the
2507     directory containing the script is writable by the operator user.  If the
2508     script is modified (resulting in a digest mismatch) it will no longer be
2509     possible to run it via sudo.
2510
2511     joe             ALL = /usr/bin/su operator
2512
2513     The user joe may only su(1) to operator.
2514
2515     pete            HPPA = /usr/bin/passwd [A-Za-z]*, !/usr/bin/passwd *root*
2516
2517     %opers          ALL = (: ADMINGRP) /usr/sbin/
2518
2519     Users in the opers group may run commands in /usr/sbin/ as themselves
2520     with any group in the ADMINGRP Runas_Alias (the adm and oper groups).
2521
2522     The user pete is allowed to change anyone's password except for root on
2523     the HPPA machines.  Because command line arguments are matched as a sin‐
2524     gle, concatenated string, the ‘*’ wildcard will match multiple words.
2525     This example assumes that passwd(1) does not take multiple user names on
2526     the command line.  Note that on GNU systems, options to passwd(1) may be
2527     specified after the user argument.  As a result, this rule will also
2528     allow:
2529
2530         passwd username --expire
2531
2532     which may not be desirable.
2533
2534     bob             SPARC = (OP) ALL : SGI = (OP) ALL
2535
2536     The user bob may run anything on the SPARC and SGI machines as any user
2537     listed in the OP Runas_Alias (root and operator.)
2538
2539     jim             +biglab = ALL
2540
2541     The user jim may run any command on machines in the biglab netgroup.
2542     sudo knows that “biglab” is a netgroup due to the ‘+’ prefix.
2543
2544     +secretaries    ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser
2545
2546     Users in the secretaries netgroup need to help manage the printers as
2547     well as add and remove users, so they are allowed to run those commands
2548     on all machines.
2549
2550     fred            ALL = (DB) NOPASSWD: ALL
2551
2552     The user fred can run commands as any user in the DB Runas_Alias (oracle
2553     or sybase) without giving a password.
2554
2555     john            ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*
2556
2557     On the ALPHA machines, user john may su to anyone except root but he is
2558     not allowed to specify any options to the su(1) command.
2559
2560     jen             ALL, !SERVERS = ALL
2561
2562     The user jen may run any command on any machine except for those in the
2563     SERVERS Host_Alias (master, mail, www and ns).
2564
2565     jill            SERVERS = /usr/bin/, !SU, !SHELLS
2566
2567     For any machine in the SERVERS Host_Alias, jill may run any commands in
2568     the directory /usr/bin/ except for those commands belonging to the SU and
2569     SHELLS Cmnd_Aliases.  While not specifically mentioned in the rule, the
2570     commands in the PAGERS Cmnd_Alias all reside in /usr/bin and have the
2571     noexec option set.
2572
2573     steve           CSNETS = (operator) /usr/local/op_commands/
2574
2575     The user steve may run any command in the directory /usr/local/op_com‐
2576     mands/ but only as user operator.
2577
2578     matt            valkyrie = KILL
2579
2580     On his personal workstation, valkyrie, matt needs to be able to kill hung
2581     processes.
2582
2583     WEBMASTERS      www = (www) ALL, (root) /usr/bin/su www
2584
2585     On the host www, any user in the WEBMASTERS User_Alias (will, wendy, and
2586     wim), may run any command as user www (which owns the web pages) or sim‐
2587     ply su(1) to www.
2588
2589     ALL             CDROM = NOPASSWD: /sbin/umount /CDROM,\
2590                     /sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM
2591
2592     Any user may mount or unmount a CD-ROM on the machines in the CDROM
2593     Host_Alias (orion, perseus, hercules) without entering a password.  This
2594     is a bit tedious for users to type, so it is a prime candidate for encap‐
2595     sulating in a shell script.
2596

SECURITY NOTES

2598   Limitations of the ‘!’ operator
2599     It is generally not effective to “subtract” commands from ALL using the
2600     ‘!’ operator.  A user can trivially circumvent this by copying the
2601     desired command to a different name and then executing that.  For exam‐
2602     ple:
2603
2604     bill    ALL = ALL, !SU, !SHELLS
2605
2606     Doesn't really prevent bill from running the commands listed in SU or
2607     SHELLS since he can simply copy those commands to a different name, or
2608     use a shell escape from an editor or other program.  Therefore, these
2609     kind of restrictions should be considered advisory at best (and rein‐
2610     forced by policy).
2611
2612     In general, if a user has sudo ALL there is nothing to prevent them from
2613     creating their own program that gives them a root shell (or making their
2614     own copy of a shell) regardless of any ‘!’ elements in the user specifi‐
2615     cation.
2616
2617   Security implications of fast_glob
2618     If the fast_glob option is in use, it is not possible to reliably negate
2619     commands where the path name includes globbing (aka wildcard) characters.
2620     This is because the C library's fnmatch(3) function cannot resolve rela‐
2621     tive paths.  While this is typically only an inconvenience for rules that
2622     grant privileges, it can result in a security issue for rules that sub‐
2623     tract or revoke privileges.
2624
2625     For example, given the following sudoers file entry:
2626
2627     john    ALL = /usr/bin/passwd [a-zA-Z0-9]*, /usr/bin/chsh [a-zA-Z0-9]*,\
2628                   /usr/bin/chfn [a-zA-Z0-9]*, !/usr/bin/* root
2629
2630     User john can still run /usr/bin/passwd root if fast_glob is enabled by
2631     changing to /usr/bin and running ./passwd root instead.
2632
2633   Preventing shell escapes
2634     Once sudo executes a program, that program is free to do whatever it
2635     pleases, including run other programs.  This can be a security issue
2636     since it is not uncommon for a program to allow shell escapes, which lets
2637     a user bypass sudo's access control and logging.  Common programs that
2638     permit shell escapes include shells (obviously), editors, paginators,
2639     mail and terminal programs.
2640
2641     There are two basic approaches to this problem:
2642
2643     restrict  Avoid giving users access to commands that allow the user to
2644               run arbitrary commands.  Many editors have a restricted mode
2645               where shell escapes are disabled, though sudoedit is a better
2646               solution to running editors via sudo.  Due to the large number
2647               of programs that offer shell escapes, restricting users to the
2648               set of programs that do not is often unworkable.
2649
2650     noexec    Many systems that support shared libraries have the ability to
2651               override default library functions by pointing an environment
2652               variable (usually LD_PRELOAD) to an alternate shared library.
2653               On such systems, sudo's noexec functionality can be used to
2654               prevent a program run by sudo from executing any other pro‐
2655               grams.  Note, however, that this applies only to native dynami‐
2656               cally-linked executables.  Statically-linked executables and
2657               foreign executables running under binary emulation are not
2658               affected.
2659
2660               The noexec feature is known to work on SunOS, Solaris, *BSD,
2661               Linux, IRIX, Tru64 UNIX, macOS, HP-UX 11.x and AIX 5.3 and
2662               above.  It should be supported on most operating systems that
2663               support the LD_PRELOAD environment variable.  Check your oper‐
2664               ating system's manual pages for the dynamic linker (usually
2665               ld.so, ld.so.1, dyld, dld.sl, rld, or loader) to see if
2666               LD_PRELOAD is supported.
2667
2668               On Solaris 10 and higher, noexec uses Solaris privileges
2669               instead of the LD_PRELOAD environment variable.
2670
2671               To enable noexec for a command, use the NOEXEC tag as docu‐
2672               mented in the User Specification section above.  Here is that
2673               example again:
2674
2675               aaron   shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
2676
2677               This allows user aaron to run /usr/bin/more and /usr/bin/vi
2678               with noexec enabled.  This will prevent those two commands from
2679               executing other commands (such as a shell).  If you are unsure
2680               whether or not your system is capable of supporting noexec you
2681               can always just try it out and check whether shell escapes work
2682               when noexec is enabled.
2683
2684     Note that restricting shell escapes is not a panacea.  Programs running
2685     as root are still capable of many potentially hazardous operations (such
2686     as changing or overwriting files) that could lead to unintended privilege
2687     escalation.  In the specific case of an editor, a safer approach is to
2688     give the user permission to run sudoedit (see below).
2689
2690   Secure editing
2691     The sudoers plugin includes sudoedit support which allows users to
2692     securely edit files with the editor of their choice.  As sudoedit is a
2693     built-in command, it must be specified in the sudoers file without a
2694     leading path.  However, it may take command line arguments just as a nor‐
2695     mal command does.  Wildcards used in sudoedit command line arguments are
2696     expected to be path names, so a forward slash (‘/’) will not be matched
2697     by a wildcard.
2698
2699     Unlike other sudo commands, the editor is run with the permissions of the
2700     invoking user and with the environment unmodified.  More information may
2701     be found in the description of the -e option in sudo(8).
2702
2703     For example, to allow user operator to edit the “message of the day”
2704     file:
2705
2706           operator        sudoedit /etc/motd
2707
2708     The operator user then runs sudoedit as follows:
2709
2710           $ sudoedit /etc/motd
2711
2712     The editor will run as the operator user, not root, on a temporary copy
2713     of /etc/motd.  After the file has been edited, /etc/motd will be updated
2714     with the contents of the temporary copy.
2715
2716     Users should never be granted sudoedit permission to edit a file that
2717     resides in a directory the user has write access to, either directly or
2718     via a wildcard.  If the user has write access to the directory it is pos‐
2719     sible to replace the legitimate file with a link to another file, allow‐
2720     ing the editing of arbitrary files.  To prevent this, starting with ver‐
2721     sion 1.8.16, symbolic links will not be followed in writable directories
2722     and sudoedit will refuse to edit a file located in a writable directory
2723     unless the sudoedit_checkdir option has been disabled or the invoking
2724     user is root.  Additionally, in version 1.8.15 and higher, sudoedit will
2725     refuse to open a symbolic link unless either the sudoedit_follow option
2726     is enabled or the sudoedit command is prefixed with the FOLLOW tag in the
2727     sudoers file.
2728
2729   Time stamp file checks
2730     sudoers will check the ownership of its time stamp directory
2731     (/run/sudo/ts by default) and ignore the directory's contents if it is
2732     not owned by root or if it is writable by a user other than root.  Older
2733     versions of sudo stored time stamp files in /tmp; this is no longer rec‐
2734     ommended as it may be possible for a user to create the time stamp them‐
2735     selves on systems that allow unprivileged users to change the ownership
2736     of files they create.
2737
2738     While the time stamp directory should be cleared at reboot time, not all
2739     systems contain a /run or /var/run directory.  To avoid potential prob‐
2740     lems, sudoers will ignore time stamp files that date from before the
2741     machine booted on systems where the boot time is available.
2742
2743     Some systems with graphical desktop environments allow unprivileged users
2744     to change the system clock.  Since sudoers relies on the system clock for
2745     time stamp validation, it may be possible on such systems for a user to
2746     run sudo for longer than timestamp_timeout by setting the clock back.  To
2747     combat this, sudoers uses a monotonic clock (which never moves backwards)
2748     for its time stamps if the system supports it.
2749
2750     sudoers will not honor time stamps set far in the future.  Time stamps
2751     with a date greater than current_time + 2 * TIMEOUT will be ignored and
2752     sudoers will log and complain.
2753
2754     If the timestamp_type option is set to “tty”, the time stamp record
2755     includes the device number of the terminal the user authenticated with.
2756     This provides per-terminal granularity but time stamp records may still
2757     outlive the user's session.
2758
2759     Unless the timestamp_type option is set to “global”, the time stamp
2760     record also includes the session ID of the process that last authenti‐
2761     cated.  This prevents processes in different terminal sessions from using
2762     the same time stamp record.  On systems where a process's start time can
2763     be queried, the start time of the session leader is recorded in the time
2764     stamp record.  If no terminal is present or the timestamp_type option is
2765     set to “ppid”, the start time of the parent process is used instead.  In
2766     most cases this will prevent a time stamp record from being re-used with‐
2767     out the user entering a password when logging out and back in again.
2768

DEBUGGING

2770     Versions 1.8.4 and higher of the sudoers plugin support a flexible debug‐
2771     ging framework that can help track down what the plugin is doing inter‐
2772     nally if there is a problem.  This can be configured in the sudo.conf(5)
2773     file.
2774
2775     The sudoers plugin uses the same debug flag format as the sudo front-end:
2776     subsystem@priority.
2777
2778     The priorities used by sudoers, in order of decreasing severity, are:
2779     crit, err, warn, notice, diag, info, trace and debug.  Each priority,
2780     when specified, also includes all priorities higher than it.  For exam‐
2781     ple, a priority of notice would include debug messages logged at notice
2782     and higher.
2783
2784     The following subsystems are used by the sudoers plugin:
2785
2786     alias     User_Alias, Runas_Alias, Host_Alias and Cmnd_Alias processing
2787
2788     all       matches every subsystem
2789
2790     audit     BSM and Linux audit code
2791
2792     auth      user authentication
2793
2794     defaults  sudoers file Defaults settings
2795
2796     env       environment handling
2797
2798     ldap      LDAP-based sudoers
2799
2800     logging   logging support
2801
2802     match     matching of users, groups, hosts and netgroups in the sudoers
2803               file
2804
2805     netif     network interface handling
2806
2807     nss       network service switch handling in sudoers
2808
2809     parser    sudoers file parsing
2810
2811     perms     permission setting
2812
2813     plugin    The equivalent of main for the plugin.
2814
2815     pty       pseudo-tty related code
2816
2817     rbtree    redblack tree internals
2818
2819     sssd      SSSD-based sudoers
2820
2821     util      utility functions
2822     For example:
2823
2824     Debug sudo /var/log/sudo_debug match@info,nss@info
2825
2826     For more information, see the sudo.conf(5) manual.
2827

SEE ALSO

2829     ssh(1), su(1), fnmatch(3), glob(3), mktemp(3), strftime(3), sudo.conf(5),
2830     sudo_plugin(5), sudoers.ldap(5), sudoers_timestamp(5), sudo(8), visudo(8)
2831

AUTHORS

2833     Many people have worked on sudo over the years; this version consists of
2834     code written primarily by:
2835
2836           Todd C. Miller
2837
2838     See the CONTRIBUTORS file in the sudo distribution
2839     (https://www.sudo.ws/contributors.html) for an exhaustive list of people
2840     who have contributed to sudo.
2841

CAVEATS

2843     The sudoers file should always be edited by the visudo command which
2844     locks the file and does grammatical checking.  It is imperative that the
2845     sudoers file be free of syntax errors since sudo will not run with a syn‐
2846     tactically incorrect sudoers file.
2847
2848     When using netgroups of machines (as opposed to users), if you store
2849     fully qualified host name in the netgroup (as is usually the case), you
2850     either need to have the machine's host name be fully qualified as
2851     returned by the hostname command or use the fqdn option in sudoers.
2852

BUGS

2854     If you feel you have found a bug in sudo, please submit a bug report at
2855     https://bugzilla.sudo.ws/
2856

SUPPORT

2858     Limited free support is available via the sudo-users mailing list, see
2859     https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
2860     the archives.
2861

DISCLAIMER

2863     sudo is provided “AS IS” and any express or implied warranties, includ‐
2864     ing, but not limited to, the implied warranties of merchantability and
2865     fitness for a particular purpose are disclaimed.  See the LICENSE file
2866     distributed with sudo or https://www.sudo.ws/license.html for complete
2867     details.
2868
2869Sudo 1.8.27                    December 20, 2018                   Sudo 1.8.27
Impressum