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 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, USERNAME and SUDO_* variables in addi‐
128     tion to variables from the invoking process permitted by the env_check
129     and env_keep options.  This is effectively a whitelist for environment
130     variables.  The environment variables LOGNAME, USER and USERNAME are
131     treated specially.  If one or more variables are preserved from the
132     invoking process, any of the three remaining variables (that were not
133     explicitly preserved) will be set to the same value as the first one in
134     the list that was preserved.  This avoids an inconsistent environment
135     where some of the variables describing the user name are set to the
136     invoking user and some are set to the target user.  () are removed unless
137     both the name and value parts are matched by env_keep or env_check, as
138     they may be interpreted as functions by the bash shell.  Prior to version
139     1.8.11, such 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.  If both Runas_Lists are speci‐
527     fied, the command may be run with any combination of users and groups
528     listed in their respective Runas_Lists. If only the first is specified,
529     the command may be run as any user in the list but no -g option may be
530     specified.  If the first Runas_List is empty but the second is specified,
531     the command may be run as the invoking user with the group set to any
532     listed in the Runas_List.  If both Runas_Lists are empty, the command may
533     only be run as the invoking user.  If no Runas_Spec is specified the com‐
534     mand may be run as root and no group may be specified.
535
536     A Runas_Spec sets the default for the commands that follow it.  What this
537     means is that for the entry:
538
539     dgb     boulder = (operator) /bin/ls, /bin/kill, /usr/bin/lprm
540
541     The user dgb may run /bin/ls, /bin/kill, and /usr/bin/lprm on the host
542     boulder—but only as operator.  E.g.,
543
544     $ sudo -u operator /bin/ls
545
546     It is also possible to override a Runas_Spec later on in an entry.  If we
547     modify the entry like so:
548
549     dgb     boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm
550
551     Then user dgb is now allowed to run /bin/ls as operator, but /bin/kill
552     and /usr/bin/lprm as root.
553
554     We can extend this to allow dgb to run /bin/ls with either the user or
555     group set to operator:
556
557     dgb     boulder = (operator : operator) /bin/ls, (root) /bin/kill,\
558             /usr/bin/lprm
559
560     Note that while the group portion of the Runas_Spec permits the user to
561     run as command with that group, it does not force the user to do so.  If
562     no group is specified on the command line, the command will run with the
563     group listed in the target user's password database entry.  The following
564     would all be permitted by the sudoers entry above:
565
566     $ sudo -u operator /bin/ls
567     $ sudo -u operator -g operator /bin/ls
568     $ sudo -g operator /bin/ls
569
570     In the following example, user tcm may run commands that access a modem
571     device file with the dialer group.
572
573     tcm     boulder = (:dialer) /usr/bin/tip, /usr/bin/cu,\
574             /usr/local/bin/minicom
575
576     Note that in this example only the group will be set, the command still
577     runs as user tcm.  E.g.
578
579     $ sudo -g dialer /usr/bin/cu
580
581     Multiple users and groups may be present in a Runas_Spec, in which case
582     the user may select any combination of users and groups via the -u and -g
583     options.  In this example:
584
585     alan    ALL = (root, bin : operator, system) ALL
586
587     user alan may run any command as either user root or bin, optionally set‐
588     ting the group to operator or system.
589
590   Option_Spec
591     A Cmnd may have zero or more options associated with it.  Depending on
592     the system, options may consist of SELinux roles and/or types, Solaris
593     privileges sets, and command timeouts.  Once an option is set for a Cmnd,
594     subsequent Cmnds in the Cmnd_Spec_List, inherit that option unless it is
595     overridden by another option.
596
597   SELinux_Spec
598     On systems with SELinux support, sudoers file entries may optionally have
599     an SELinux role and/or type associated with a command.  If a role or type
600     is specified with the command it will override any default values speci‐
601     fied in sudoers.  A role or type specified on the command line, however,
602     will supersede the values in sudoers.
603
604   Date_Spec
605     sudoers rules can be specified with a start and end date via the
606     NOTBEFORE and NOTAFTER settings.  The time stamp must be specified in
607     Generalized Time as defined by RFC 4517.  The format is effectively
608     yyyymmddHHMMSSZ where the minutes and seconds are optional.  The ‘Z’ suf‐
609     fix indicates that the time stamp is in Coordinated Universal Time (UTC).
610     It is also possible to specify a timezone offset from UTC in hours and
611     minutes instead of a ‘Z’.  For example, ‘-0500’ would correspond to East‐
612     ern Standard time in the US.  As an extension, if no ‘Z’ or timezone off‐
613     set is specified, local time will be used.
614
615     The following are all valid time stamps:
616
617         20170214083000Z
618         2017021408Z
619         20160315220000-0500
620         20151201235900
621
622   Timeout_Spec
623     A command may have a timeout associated with it.  If the timeout expires
624     before the command has exited, the command will be terminated.  The time‐
625     out may be specified in combinations of days, hours, minutes and seconds
626     with a single-letter case-insensitive suffix that indicates the unit of
627     time.  For example, a timeout of 7 days, 8 hours, 30 minutes and 10 sec‐
628     onds would be written as 7d8h30m10s.  If a number is specified without a
629     unit, seconds are assumed.  Any of the days, minutes, hours or seconds
630     may be omitted.  The order must be from largest to smallest unit and a
631     unit may not be specified more than once.
632
633     The following are all valid timeout values: 7d8h30m10s, 14d, 8h30m, 600s,
634     3600.  The following are invalid timeout values: 12m2w1d, 30s10m4h,
635     1d2d3h.
636
637     This option is only supported by version 1.8.20 or higher.
638
639   Tag_Spec
640     A command may have zero or more tags associated with it.  The following
641     tag values are supported: EXEC, NOEXEC, FOLLOW, NOFOLLOW, LOG_INPUT,
642     NOLOG_INPUT, LOG_OUTPUT, NOLOG_OUTPUT, MAIL, NOMAIL, PASSWD, NOPASSWD,
643     SETENV, and NOSETENV.  Once a tag is set on a Cmnd, subsequent Cmnds in
644     the Cmnd_Spec_List, inherit the tag unless it is overridden by the oppo‐
645     site tag (in other words, PASSWD overrides NOPASSWD and NOEXEC overrides
646     EXEC).
647
648     EXEC and NOEXEC
649
650       If sudo has been compiled with noexec support and the underlying oper‐
651       ating system supports it, the NOEXEC tag can be used to prevent a
652       dynamically-linked executable from running further commands itself.
653
654       In the following example, user aaron may run /usr/bin/more and
655       /usr/bin/vi but shell escapes will be disabled.
656
657       aaron   shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
658
659       See the Preventing shell escapes section below for more details on how
660       NOEXEC works and whether or not it will work on your system.
661
662     FOLLOW and NOFOLLOW Starting with version 1.8.15, sudoedit will not open
663       a file that is a symbolic link unless the sudoedit_follow option is
664       enabled.  The FOLLOW and NOFOLLOW tags override the value of
665       sudoedit_follow and can be used to permit (or deny) the editing of sym‐
666       bolic links on a per-command basis.  These tags are only effective for
667       the sudoedit command and are ignored for all other commands.
668
669     LOG_INPUT and NOLOG_INPUT
670
671       These tags override the value of the log_input option on a per-command
672       basis.  For more information, see the description of log_input in the
673       SUDOERS OPTIONS section below.
674
675     LOG_OUTPUT and NOLOG_OUTPUT
676
677       These tags override the value of the log_output option on a per-command
678       basis.  For more information, see the description of log_output in the
679       SUDOERS OPTIONS section below.
680
681     MAIL and NOMAIL
682
683       These tags provide fine-grained control over whether mail will be sent
684       when a user runs a command by overriding the value of the
685       mail_all_cmnds option on a per-command basis.  They have no effect when
686       sudo is run with the -l or -v options.  A NOMAIL tag will also override
687       the mail_always and mail_no_perms options.  For more information, see
688       the descriptions of mail_all_cmnds, mail_always, and mail_no_perms in
689       the SUDOERS OPTIONS section below.
690
691     PASSWD and NOPASSWD
692
693       By default, sudo requires that a user authenticate him or herself
694       before running a command.  This behavior can be modified via the
695       NOPASSWD tag.  Like a Runas_Spec, the NOPASSWD tag sets a default for
696       the commands that follow it in the Cmnd_Spec_List.  Conversely, the
697       PASSWD tag can be used to reverse things.  For example:
698
699       ray     rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
700
701       would allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm
702       as root on the machine rushmore without authenticating himself.  If we
703       only want ray to be able to run /bin/kill without a password the entry
704       would be:
705
706       ray     rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
707
708       Note, however, that the PASSWD tag has no effect on users who are in
709       the group specified by the exempt_group option.
710
711       By default, if the NOPASSWD tag is applied to any of the entries for a
712       user on the current host, he or she will be able to run “sudo -l” with‐
713       out a password.  Additionally, a user may only run “sudo -v” without a
714       password if the NOPASSWD tag is present for all a user's entries that
715       pertain to the current host.  This behavior may be overridden via the
716       verifypw and listpw options.
717
718     SETENV and NOSETENV
719
720       These tags override the value of the setenv option on a per-command
721       basis.  Note that if SETENV has been set for a command, the user may
722       disable the env_reset option from the command line via the -E option.
723       Additionally, environment variables set on the command line are not
724       subject to the restrictions imposed by env_check, env_delete, or
725       env_keep.  As such, only trusted users should be allowed to set vari‐
726       ables in this manner.  If the command matched is ALL, the SETENV tag is
727       implied for that command; this default may be overridden by use of the
728       NOSETENV tag.
729
730   Wildcards
731     sudo allows shell-style wildcards (aka meta or glob characters) to be
732     used in host names, path names and command line arguments in the sudoers
733     file.  Wildcard matching is done via the glob(3) and fnmatch(3) functions
734     as specified by IEEE Std 1003.1 (“POSIX.1”).
735
736     *         Matches any set of zero or more characters (including white
737               space).
738
739     ?         Matches any single character (including white space).
740
741     [...]     Matches any character in the specified range.
742
743     [!...]    Matches any character not in the specified range.
744
745     \x        For any character ‘x’, evaluates to ‘x’.  This is used to
746               escape special characters such as: ‘*’, ‘?’, ‘[’, and ‘]’.
747
748     Note that these are not regular expressions.  Unlike a regular expression
749     there is no way to match one or more characters within a range.
750
751     Character classes may be used if your system's glob(3) and fnmatch(3)
752     functions support them.  However, because the ‘:’ character has special
753     meaning in sudoers, it must be escaped.  For example:
754
755         /bin/ls [[\:alpha\:]]*
756
757     Would match any file name beginning with a letter.
758
759     Note that a forward slash (‘/’) will not be matched by wildcards used in
760     the file name portion of the command.  This is to make a path like:
761
762         /usr/bin/*
763
764     match /usr/bin/who but not /usr/bin/X11/xterm.
765
766     When matching the command line arguments, however, a slash does get
767     matched by wildcards since command line arguments may contain arbitrary
768     strings and not just path names.
769
770     Wildcards in command line arguments should be used with care.
771     Command line arguments are matched as a single, concatenated string.
772     This mean a wildcard character such as ‘?’ or ‘*’ will match across word
773     boundaries, which may be unexpected.  For example, while a sudoers entry
774     like:
775
776         %operator ALL = /bin/cat /var/log/messages*
777
778     will allow command like:
779
780         $ sudo cat /var/log/messages.1
781
782     It will also allow:
783
784         $ sudo cat /var/log/messages /etc/shadow
785
786     which is probably not what was intended.  In most cases it is better to
787     do command line processing outside of the sudoers file in a scripting
788     language.
789
790   Exceptions to wildcard rules
791     The following exceptions apply to the above rules:
792
793     ""        If the empty string "" is the only command line argument in the
794               sudoers file entry it means that command is not allowed to be
795               run with any arguments.
796
797     sudoedit  Command line arguments to the sudoedit built-in command should
798               always be path names, so a forward slash (‘/’) will not be
799               matched by a wildcard.
800
801   Including other files from within sudoers
802     It is possible to include other sudoers files from within the sudoers
803     file currently being parsed using the #include and #includedir direc‐
804     tives.
805
806     This can be used, for example, to keep a site-wide sudoers file in addi‐
807     tion to a local, per-machine file.  For the sake of this example the
808     site-wide sudoers file will be /etc/sudoers and the per-machine one will
809     be /etc/sudoers.local.  To include /etc/sudoers.local from within
810     /etc/sudoers we would use the following line in /etc/sudoers:
811
812         #include /etc/sudoers.local
813
814     When sudo reaches this line it will suspend processing of the current
815     file (/etc/sudoers) and switch to /etc/sudoers.local.  Upon reaching the
816     end of /etc/sudoers.local, the rest of /etc/sudoers will be processed.
817     Files that are included may themselves include other files.  A hard limit
818     of 128 nested include files is enforced to prevent include file loops.
819
820     If the path to the include file is not fully-qualified (does not begin
821     with a ‘/’), it must be located in the same directory as the sudoers file
822     it was included from.  For example, if /etc/sudoers contains the line:
823
824         #include sudoers.local
825
826     the file that will be included is /etc/sudoers.local.
827
828     The file name may also include the %h escape, signifying the short form
829     of the host name.  In other words, if the machine's host name is
830     “xerxes”, then
831
832         #include /etc/sudoers.%h
833
834     will cause sudo to include the file /etc/sudoers.xerxes.
835
836     The #includedir directive can be used to create a sudoers.d directory
837     that the system package manager can drop sudoers file rules into as part
838     of package installation.  For example, given:
839
840         #includedir /etc/sudoers.d
841
842     sudo will suspend processing of the current file and read each file in
843     /etc/sudoers.d, skipping file names that end in ‘~’ or contain a ‘.’
844     character to avoid causing problems with package manager or editor tempo‐
845     rary/backup files.  Files are parsed in sorted lexical order.  That is,
846     /etc/sudoers.d/01_first will be parsed before /etc/sudoers.d/10_second.
847     Be aware that because the sorting is lexical, not numeric,
848     /etc/sudoers.d/1_whoops would be loaded after /etc/sudoers.d/10_second.
849     Using a consistent number of leading zeroes in the file names can be used
850     to avoid such problems.  After parsing the files in the directory, con‐
851     trol returns to the file that contained the #includedir directive.
852
853     Note that unlike files included via #include, visudo will not edit the
854     files in a #includedir directory unless one of them contains a syntax
855     error.  It is still possible to run visudo with the -f flag to edit the
856     files directly, but this will not catch the redefinition of an alias that
857     is also present in a different file.
858
859   Other special characters and reserved words
860     The pound sign (‘#’) is used to indicate a comment (unless it is part of
861     a #include directive or unless it occurs in the context of a user name
862     and is followed by one or more digits, in which case it is treated as a
863     uid).  Both the comment character and any text after it, up to the end of
864     the line, are ignored.
865
866     The reserved word ALL is a built-in alias that always causes a match to
867     succeed.  It can be used wherever one might otherwise use a Cmnd_Alias,
868     User_Alias, Runas_Alias, or Host_Alias.  You should not try to define
869     your own alias called ALL as the built-in alias will be used in prefer‐
870     ence to your own.  Please note that using ALL can be dangerous since in a
871     command context, it allows the user to run any command on the system.
872
873     An exclamation point (‘!’) can be used as a logical not operator in a
874     list or alias as well as in front of a Cmnd.  This allows one to exclude
875     certain values.  For the ‘!’ operator to be effective, there must be
876     something for it to exclude.  For example, to match all users except for
877     root one would use:
878
879         ALL,!root
880
881     If the ALL, is omitted, as in:
882
883         !root
884
885     it would explicitly deny root but not match any other users.  This is
886     different from a true “negation” operator.
887
888     Note, however, that using a ‘!’ in conjunction with the built-in ALL
889     alias to allow a user to run “all but a few” commands rarely works as
890     intended (see SECURITY NOTES below).
891
892     Long lines can be continued with a backslash (‘\’) as the last character
893     on the line.
894
895     White space between elements in a list as well as special syntactic char‐
896     acters in a User Specification (‘=’, ‘:’, ‘(’, ‘)’) is optional.
897
898     The following characters must be escaped with a backslash (‘\’) when used
899     as part of a word (e.g. a user name or host name): ‘!’, ‘=’, ‘:’, ‘,’,
900     ‘(’, ‘)’, ‘\’.
901

SUDOERS OPTIONS

903     sudo's behavior can be modified by Default_Entry lines, as explained ear‐
904     lier.  A list of all supported Defaults parameters, grouped by type, are
905     listed below.
906
907     Boolean Flags:
908
909     always_query_group_plugin
910                       If a group_plugin is configured, use it to resolve
911                       groups of the form %group as long as there is not also
912                       a system group of the same name.  Normally, only groups
913                       of the form %:group are passed to the group_plugin.
914                       This flag is off by default.
915
916     always_set_home   If enabled, sudo will set the HOME environment variable
917                       to the home directory of the target user (which is root
918                       unless the -u option is used).  This effectively means
919                       that the -H option is always implied.  Note that by
920                       default, HOME will be set to the home directory of the
921                       target user when the env_reset option is enabled, so
922                       always_set_home only has an effect for configurations
923                       where either env_reset is disabled or HOME is present
924                       in the env_keep list.  This flag is off by default.
925
926     authenticate      If set, users must authenticate themselves via a pass‐
927                       word (or other means of authentication) before they may
928                       run commands.  This default may be overridden via the
929                       PASSWD and NOPASSWD tags.  This flag is on by default.
930
931     case_insensitive_group
932                       If enabled, group names in sudoers will be matched in a
933                       case insensitive manner.  This may be necessary when
934                       users are stored in LDAP or AD.  This flag is on by
935                       default.
936
937     case_insensitive_user
938                       If enabled, user names in sudoers will be matched in a
939                       case insensitive manner.  This may be necessary when
940                       groups are stored in LDAP or AD.  This flag is on by
941                       default.
942
943     closefrom_override
944                       If set, the user may use sudo's -C option which over‐
945                       rides the default starting point at which sudo begins
946                       closing open file descriptors.  This flag is off by
947                       default.
948
949     compress_io       If set, and sudo is configured to log a command's input
950                       or output, the I/O logs will be compressed using zlib.
951                       This flag is on by default when sudo is compiled with
952                       zlib support.
953
954     exec_background   By default, sudo runs a command as the foreground
955                       process as long as sudo itself is running in the fore‐
956                       ground.  When the exec_background flag is enabled and
957                       the command is being run in a pty (due to I/O logging
958                       or the use_pty flag), the command will be run as a
959                       background process.  Attempts to read from the control‐
960                       ling terminal (or to change terminal settings) will
961                       result in the command being suspended with the SIGTTIN
962                       signal (or SIGTTOU in the case of terminal settings).
963                       If this happens when sudo is a foreground process, the
964                       command will be granted the controlling terminal and
965                       resumed in the foreground with no user intervention
966                       required.  The advantage of initially running the com‐
967                       mand in the background is that sudo need not read from
968                       the terminal unless the command explicitly requests it.
969                       Otherwise, any terminal input must be passed to the
970                       command, whether it has required it or not (the kernel
971                       buffers terminals so it is not possible to tell whether
972                       the command really wants the input).  This is different
973                       from historic sudo behavior or when the command is not
974                       being run in a pty.
975
976                       For this to work seamlessly, the operating system must
977                       support the automatic restarting of system calls.
978                       Unfortunately, not all operating systems do this by
979                       default, and even those that do may have bugs.  For
980                       example, macOS fails to restart the tcgetattr() and
981                       tcsetattr() system calls (this is a bug in macOS).
982                       Furthermore, because this behavior depends on the com‐
983                       mand stopping with the SIGTTIN or SIGTTOU signals, pro‐
984                       grams that catch these signals and suspend themselves
985                       with a different signal (usually SIGTOP) will not be
986                       automatically foregrounded.  Some versions of the linux
987                       su(1) command behave this way.  This flag is off by
988                       default.
989
990                       This setting is only supported by version 1.8.7 or
991                       higher.  It has no effect unless I/O logging is enabled
992                       or the use_pty flag is enabled.
993
994     env_editor        If set, visudo will use the value of the SUDO_EDITOR,
995                       VISUAL or EDITOR environment variables before falling
996                       back on the default editor list.  Note that this may
997                       create a security hole as it allows the user to run any
998                       arbitrary command as root without logging.  A safer
999                       alternative is to place a colon-separated list of edi‐
1000                       tors in the editor variable.  visudo will then only use
1001                       SUDO_EDITOR, VISUAL or EDITOR if they match a value
1002                       specified in editor.  If the env_reset flag is enabled,
1003                       the SUDO_EDITOR, VISUAL and/or EDITOR environment vari‐
1004                       ables must be present in the env_keep list for the
1005                       env_editor flag to function when visudo is invoked via
1006                       sudo.  This flag is on by default.
1007
1008     env_reset         If set, sudo will run the command in a minimal environ‐
1009                       ment containing the TERM, PATH, HOME, MAIL, SHELL,
1010                       LOGNAME, USER, USERNAME and SUDO_* variables.  Any
1011                       variables in the caller's environment or in the file
1012                       specified by the restricted_env_file option that match
1013                       the env_keep and env_check lists are then added, fol‐
1014                       lowed by any variables present in the file specified by
1015                       the env_file option (if any).  The contents of the
1016                       env_keep and env_check lists, as modified by global
1017                       Defaults parameters in sudoers, are displayed when sudo
1018                       is run by root with the -V option.  If the secure_path
1019                       option is set, its value will be used for the PATH
1020                       environment variable.  This flag is on by default.
1021
1022     fast_glob         Normally, sudo uses the glob(3) function to do shell-
1023                       style globbing when matching path names.  However,
1024                       since it accesses the file system, glob(3) can take a
1025                       long time to complete for some patterns, especially
1026                       when the pattern references a network file system that
1027                       is mounted on demand (auto mounted).  The fast_glob
1028                       option causes sudo to use the fnmatch(3) function,
1029                       which does not access the file system to do its match‐
1030                       ing.  The disadvantage of fast_glob is that it is
1031                       unable to match relative path names such as ./ls or
1032                       ../bin/ls.  This has security implications when path
1033                       names that include globbing characters are used with
1034                       the negation operator, ‘!’, as such rules can be triv‐
1035                       ially bypassed.  As such, this option should not be
1036                       used when the sudoers file contains rules that contain
1037                       negated path names which include globbing characters.
1038                       This flag is off by default.
1039
1040     fqdn              Set this flag if you want to put fully qualified host
1041                       names in the sudoers file when the local host name (as
1042                       returned by the hostname command) does not contain the
1043                       domain name.  In other words, instead of myhost you
1044                       would use myhost.mydomain.edu.  You may still use the
1045                       short form if you wish (and even mix the two).  This
1046                       option is only effective when the “canonical” host
1047                       name, as returned by the getaddrinfo() or
1048                       gethostbyname() function, is a fully-qualified domain
1049                       name.  This is usually the case when the system is con‐
1050                       figured to use DNS for host name resolution.
1051
1052                       If the system is configured to use the /etc/hosts file
1053                       in preference to DNS, the “canonical” host name may not
1054                       be fully-qualified.  The order that sources are queried
1055                       for host name resolution is usually specified in the
1056                       /etc/nsswitch.conf, /etc/netsvc.conf, /etc/host.conf,
1057                       or, in some cases, /etc/resolv.conf file.  In the
1058                       /etc/hosts file, the first host name of the entry is
1059                       considered to be the “canonical” name; subsequent names
1060                       are aliases that are not used by sudoers.  For example,
1061                       the following hosts file line for the machine “xyzzy”
1062                       has the fully-qualified domain name as the “canonical”
1063                       host name, and the short version as an alias.
1064
1065                             192.168.1.1    xyzzy.sudo.ws xyzzy
1066
1067                       If the machine's hosts file entry is not formatted
1068                       properly, the fqdn option will not be effective if it
1069                       is queried before DNS.
1070
1071                       Beware that when using DNS for host name resolution,
1072                       turning on fqdn requires sudoers to make DNS lookups
1073                       which renders sudo unusable if DNS stops working (for
1074                       example if the machine is disconnected from the net‐
1075                       work).  Also note that just like with the hosts file,
1076                       you must use the “canonical” name as DNS knows it.
1077                       That is, you may not use a host alias (CNAME entry) due
1078                       to performance issues and the fact that there is no way
1079                       to get all aliases from DNS.
1080
1081                       This flag is off by default.
1082
1083     ignore_audit_errors
1084                       Allow commands to be run even if sudoers cannot write
1085                       to the audit log.  If enabled, an audit log write fail‐
1086                       ure is not treated as a fatal error.  If disabled, a
1087                       command may only be run after the audit event is suc‐
1088                       cessfully written.  This flag is only effective on sys‐
1089                       tems for which sudoers supports audit logging, includ‐
1090                       ing FreeBSD, Linux, macOS and Solaris.  This flag is on
1091                       by default.
1092
1093     ignore_dot        If set, sudo will ignore "." or "" (both denoting cur‐
1094                       rent directory) in the PATH environment variable; the
1095                       PATH itself is not modified.  This flag is on by
1096                       default.
1097
1098     ignore_iolog_errors
1099                       Allow commands to be run even if sudoers cannot write
1100                       to the I/O log.  If enabled, an I/O log write failure
1101                       is not treated as a fatal error.  If disabled, the com‐
1102                       mand will be terminated if the I/O log cannot be writ‐
1103                       ten to.  This flag is off by default.
1104
1105     ignore_logfile_errors
1106                       Allow commands to be run even if sudoers cannot write
1107                       to the log file.  If enabled, a log file write failure
1108                       is not treated as a fatal error.  If disabled, a com‐
1109                       mand may only be run after the log file entry is suc‐
1110                       cessfully written.  This flag only has an effect when
1111                       sudoers is configured to use file-based logging via the
1112                       logfile option.  This flag is on by default.
1113
1114     ignore_local_sudoers
1115                       If set via LDAP, parsing of /etc/sudoers will be
1116                       skipped.  This is intended for Enterprises that wish to
1117                       prevent the usage of local sudoers files so that only
1118                       LDAP is used.  This thwarts the efforts of rogue opera‐
1119                       tors who would attempt to add roles to /etc/sudoers.
1120                       When this option is present, /etc/sudoers does not even
1121                       need to exist.  Since this option tells sudo how to
1122                       behave when no specific LDAP entries have been matched,
1123                       this sudoOption is only meaningful for the cn=defaults
1124                       section.  This flag is off by default.
1125
1126     ignore_unknown_defaults
1127                       If set, sudo will not produce a warning if it encoun‐
1128                       ters an unknown Defaults entry in the sudoers file or
1129                       an unknown sudoOption in LDAP.  This flag is off by
1130                       default.
1131
1132     insults           If set, sudo will insult users when they enter an
1133                       incorrect password.  This flag is off by default.
1134
1135     log_host          If set, the host name will be logged in the (non-sys‐
1136                       log) sudo log file.  This flag is off by default.
1137
1138     log_input         If set, sudo will run the command in a pseudo-tty and
1139                       log all user input.  If the standard input is not con‐
1140                       nected to the user's tty, due to I/O redirection or
1141                       because the command is part of a pipeline, that input
1142                       is also captured and stored in a separate log file.
1143                       Anything sent to the standard input will be consumed,
1144                       regardless of whether or not the command run via sudo
1145                       is actually reading the standard input.  This may have
1146                       unexpected results when using sudo in a shell script
1147                       that expects to process the standard input.  For more
1148                       information about I/O logging, see the I/O LOG FILES
1149                       section.  This flag is off by default.
1150
1151     log_output        If set, sudo will run the command in a pseudo-tty and
1152                       log all output that is sent to the screen, similar to
1153                       the script(1) command.  For more information about I/O
1154                       logging, see the I/O LOG FILES section.  This flag is
1155                       off by default.
1156
1157     log_year          If set, the four-digit year will be logged in the (non-
1158                       syslog) sudo log file.  This flag is off by default.
1159
1160     long_otp_prompt   When validating with a One Time Password (OTP) scheme
1161                       such as S/Key or OPIE, a two-line prompt is used to
1162                       make it easier to cut and paste the challenge to a
1163                       local window.  It's not as pretty as the default but
1164                       some people find it more convenient.  This flag is off
1165                       by default.
1166
1167     mail_all_cmnds    Send mail to the mailto user every time a user attempts
1168                       to run a command via sudo (this includes sudoedit).  No
1169                       mail will be sent if the user runs sudo with the -l or
1170                       -v option unless there is an authentication error and
1171                       the mail_badpass flag is also set.  This flag is off by
1172                       default.
1173
1174     mail_always       Send mail to the mailto user every time a user runs
1175                       sudo.  This flag is off by default.
1176
1177     mail_badpass      Send mail to the mailto user if the user running sudo
1178                       does not enter the correct password.  If the command
1179                       the user is attempting to run is not permitted by
1180                       sudoers and one of the mail_all_cmnds, mail_always,
1181                       mail_no_host, mail_no_perms or mail_no_user flags are
1182                       set, this flag will have no effect.  This flag is off
1183                       by default.
1184
1185     mail_no_host      If set, mail will be sent to the mailto user if the
1186                       invoking user exists in the sudoers file, but is not
1187                       allowed to run commands on the current host.  This flag
1188                       is off by default.
1189
1190     mail_no_perms     If set, mail will be sent to the mailto user if the
1191                       invoking user is allowed to use sudo but the command
1192                       they are trying is not listed in their sudoers file
1193                       entry or is explicitly denied.  This flag is off by
1194                       default.
1195
1196     mail_no_user      If set, mail will be sent to the mailto user if the
1197                       invoking user is not in the sudoers file.  This flag is
1198                       on by default.
1199
1200     match_group_by_gid
1201                       By default, sudoers will look up each group the user is
1202                       a member of by group ID to determine the group name
1203                       (this is only done once).  The resulting list of the
1204                       user's group names is used when matching groups listed
1205                       in the sudoers file.  This works well on systems where
1206                       the number of groups listed in the sudoers file is
1207                       larger than the number of groups a typical user belongs
1208                       to.  On systems where group lookups are slow, where
1209                       users may belong to a large number of groups, and where
1210                       the number of groups listed in the sudoers file is rel‐
1211                       atively small, it may be prohibitively expensive and
1212                       running commands via sudo may take longer than normal.
1213                       On such systems it may be faster to use the
1214                       match_group_by_gid flag to avoid resolving the user's
1215                       group IDs to group names.  In this case, sudoers must
1216                       look up any group name listed in the sudoers file and
1217                       use the group ID instead of the group name when deter‐
1218                       mining whether the user is a member of the group.
1219
1220                       Note that if match_group_by_gid is enabled, group data‐
1221                       base lookups performed by sudoers will be keyed by
1222                       group name as opposed to group ID.  On systems where
1223                       there are multiple sources for the group database, it
1224                       is possible to have conflicting group names or group
1225                       IDs in the local /etc/group file and the remote group
1226                       database.  On such systems, enabling or disabling
1227                       match_group_by_gid can be used to choose whether group
1228                       database queries are performed by name (enabled) or ID
1229                       (disabled), which may aid in working around group entry
1230                       conflicts.
1231
1232                       The match_group_by_gid flag has no effect when sudoers
1233                       data is stored in LDAP.  This flag is off by default.
1234
1235                       This setting is only supported by version 1.8.18 or
1236                       higher.
1237
1238     netgroup_tuple    If set, netgroup lookups will be performed using the
1239                       full netgroup tuple: host name, user name and domain
1240                       (if one is set).  Historically, sudo only matched the
1241                       user name and domain for netgroups used in a User_List
1242                       and only matched the host name and domain for netgroups
1243                       used in a Host_List.  This flag is off by default.
1244
1245     noexec            If set, all commands run via sudo will behave as if the
1246                       NOEXEC tag has been set, unless overridden by an EXEC
1247                       tag.  See the description of EXEC and NOEXEC above as
1248                       well as the Preventing shell escapes section at the end
1249                       of this manual.  This flag is off by default.
1250
1251     pam_session       On systems that use PAM for authentication, sudo will
1252                       create a new PAM session for the command to be run in.
1253                       Disabling pam_session may be needed on older PAM imple‐
1254                       mentations or on operating systems where opening a PAM
1255                       session changes the utmp or wtmp files.  If PAM session
1256                       support is disabled, resource limits may not be updated
1257                       for the command being run.  If pam_session,
1258                       pam_setcred, and use_pty are disabled and I/O logging
1259                       has not been configured, sudo will execute the command
1260                       directly instead of running it as a child process.
1261                       This flag is on by default.
1262
1263                       This setting is only supported by version 1.8.7 or
1264                       higher.
1265
1266     pam_setcred       On systems that use PAM for authentication, sudo will
1267                       attempt to establish credentials for the target user by
1268                       default, if supported by the underlying authentication
1269                       system.  One example of a credential is a Kerberos
1270                       ticket.  If pam_session, pam_setcred, and use_pty are
1271                       disabled and I/O logging has not been configured, sudo
1272                       will execute the command directly instead of running it
1273                       as a child process.  This flag is on by default.
1274
1275                       This setting is only supported by version 1.8.8 or
1276                       higher.
1277
1278     passprompt_override
1279                       If set, the prompt specified by passprompt or the
1280                       SUDO_PROMPT environment variable will always be used
1281                       and will replace the prompt provided by a PAM module or
1282                       other authentication method.  This flag is off by
1283                       default.
1284
1285     path_info         Normally, sudo will tell the user when a command could
1286                       not be found in their PATH environment variable.  Some
1287                       sites may wish to disable this as it could be used to
1288                       gather information on the location of executables that
1289                       the normal user does not have access to.  The disadvan‐
1290                       tage is that if the executable is simply not in the
1291                       user's PATH, sudo will tell the user that they are not
1292                       allowed to run it, which can be confusing.  This flag
1293                       is on by default.
1294
1295     preserve_groups   By default, sudo will initialize the group vector to
1296                       the list of groups the target user is in.  When
1297                       preserve_groups is set, the user's existing group vec‐
1298                       tor is left unaltered.  The real and effective group
1299                       IDs, however, are still set to match the target user.
1300                       This flag is off by default.
1301
1302     pwfeedback        By default, sudo reads the password like most other
1303                       Unix programs, by turning off echo until the user hits
1304                       the return (or enter) key.  Some users become confused
1305                       by this as it appears to them that sudo has hung at
1306                       this point.  When pwfeedback is set, sudo will provide
1307                       visual feedback when the user presses a key.  Note that
1308                       this does have a security impact as an onlooker may be
1309                       able to determine the length of the password being
1310                       entered.  This flag is off by default.
1311
1312     requiretty        If set, sudo will only run when the user is logged in
1313                       to a real tty.  When this flag is set, sudo can only be
1314                       run from a login session and not via other means such
1315                       as cron(8) or cgi-bin scripts.  This flag is off by
1316                       default.
1317
1318     root_sudo         If set, root is allowed to run sudo too.  Disabling
1319                       this prevents users from “chaining” sudo commands to
1320                       get a root shell by doing something like “sudo sudo
1321                       /bin/sh”.  Note, however, that turning off root_sudo
1322                       will also prevent root from running sudoedit.  Dis‐
1323                       abling root_sudo provides no real additional security;
1324                       it exists purely for historical reasons.  This flag is
1325                       on by default.
1326
1327     rootpw            If set, sudo will prompt for the root password instead
1328                       of the password of the invoking user when running a
1329                       command or editing a file.  This flag is off by
1330                       default.
1331
1332     runaspw           If set, sudo will prompt for the password of the user
1333                       defined by the runas_default option (defaults to root)
1334                       instead of the password of the invoking user when run‐
1335                       ning a command or editing a file.  This flag is off by
1336                       default.
1337
1338     set_home          If enabled and sudo is invoked with the -s option the
1339                       HOME environment variable will be set to the home
1340                       directory of the target user (which is root unless the
1341                       -u option is used).  This effectively makes the -s
1342                       option imply -H.  Note that HOME is already set when
1343                       the env_reset option is enabled, so set_home is only
1344                       effective for configurations where either env_reset is
1345                       disabled or HOME is present in the env_keep list.  This
1346                       flag is off by default.
1347
1348     set_logname       Normally, sudo will set the LOGNAME, USER and USERNAME
1349                       environment variables to the name of the target user
1350                       (usually root unless the -u option is given).  However,
1351                       since some programs (including the RCS revision control
1352                       system) use LOGNAME to determine the real identity of
1353                       the user, it may be desirable to change this behavior.
1354                       This can be done by negating the set_logname option.
1355                       Note that set_logname will have no effect if the
1356                       env_reset option has not been disabled and the env_keep
1357                       list contains LOGNAME, USER or USERNAME.  This flag is
1358                       on by default.
1359
1360     set_utmp          When enabled, sudo will create an entry in the utmp (or
1361                       utmpx) file when a pseudo-tty is allocated.  A pseudo-
1362                       tty is allocated by sudo when the log_input, log_output
1363                       or use_pty flags are enabled.  By default, the new
1364                       entry will be a copy of the user's existing utmp entry
1365                       (if any), with the tty, time, type and pid fields
1366                       updated.  This flag is on by default.
1367
1368     setenv            Allow the user to disable the env_reset option from the
1369                       command line via the -E option.  Additionally, environ‐
1370                       ment variables set via the command line are not subject
1371                       to the restrictions imposed by env_check, env_delete,
1372                       or env_keep.  As such, only trusted users should be
1373                       allowed to set variables in this manner.  This flag is
1374                       off by default.
1375
1376     shell_noargs      If set and sudo is invoked with no arguments it acts as
1377                       if the -s option had been given.  That is, it runs a
1378                       shell as root (the shell is determined by the SHELL
1379                       environment variable if it is set, falling back on the
1380                       shell listed in the invoking user's /etc/passwd entry
1381                       if not).  This flag is off by default.
1382
1383     stay_setuid       Normally, when sudo executes a command the real and
1384                       effective UIDs are set to the target user (root by
1385                       default).  This option changes that behavior such that
1386                       the real UID is left as the invoking user's UID.  In
1387                       other words, this makes sudo act as a setuid wrapper.
1388                       This can be useful on systems that disable some poten‐
1389                       tially dangerous functionality when a program is run
1390                       setuid.  This option is only effective on systems that
1391                       support either the setreuid(2) or setresuid(2) system
1392                       call.  This flag is off by default.
1393
1394     sudoedit_checkdir
1395                       If set, sudoedit will check all directory components of
1396                       the path to be edited for writability by the invoking
1397                       user.  Symbolic links will not be followed in writable
1398                       directories and sudoedit will refuse to edit a file
1399                       located in a writable directory.  These restrictions
1400                       are not enforced when sudoedit is run by root.  On some
1401                       systems, if all directory components of the path to be
1402                       edited are not readable by the target user, sudoedit
1403                       will be unable to edit the file.  This flag is on by
1404                       default.
1405
1406                       This setting was first introduced in version 1.8.15 but
1407                       initially suffered from a race condition.  The check
1408                       for symbolic links in writable intermediate directories
1409                       was added in version 1.8.16.
1410
1411     sudoedit_follow   By default, sudoedit will not follow symbolic links
1412                       when opening files.  The sudoedit_follow option can be
1413                       enabled to allow sudoedit to open symbolic links.  It
1414                       may be overridden on a per-command basis by the FOLLOW
1415                       and NOFOLLOW tags.  This flag is off by default.
1416
1417                       This setting is only supported by version 1.8.15 or
1418                       higher.
1419
1420     syslog_pid        When logging via syslog(3), include the process ID in
1421                       the log entry.  This flag is off by default.
1422
1423                       This setting is only supported by version 1.8.21 or
1424                       higher.
1425
1426     targetpw          If set, sudo will prompt for the password of the user
1427                       specified by the -u option (defaults to root) instead
1428                       of the password of the invoking user when running a
1429                       command or editing a file.  Note that this flag pre‐
1430                       cludes the use of a uid not listed in the passwd data‐
1431                       base as an argument to the -u option.  This flag is off
1432                       by default.
1433
1434     tty_tickets       If set, users must authenticate on a per-tty basis.
1435                       With this flag enabled, sudo will use a separate record
1436                       in the time stamp file for each terminal.  If disabled,
1437                       a single record is used for all login sessions.
1438
1439                       This option has been superseded by the timestamp_type
1440                       option.
1441
1442     umask_override    If set, sudo will set the umask as specified in the
1443                       sudoers file without modification.  This makes it pos‐
1444                       sible to specify a umask in the sudoers file that is
1445                       more permissive than the user's own umask and matches
1446                       historical behavior.  If umask_override is not set,
1447                       sudo will set the umask to be the union of the user's
1448                       umask and what is specified in sudoers.  This flag is
1449                       off by default.
1450
1451     use_netgroups     If set, netgroups (prefixed with ‘+’), may be used in
1452                       place of a user or host.  For LDAP-based sudoers, net‐
1453                       group support requires an expensive sub-string match on
1454                       the server unless the NETGROUP_BASE directive is
1455                       present in the /etc/sudo-ldap.conf file.  If netgroups
1456                       are not needed, this option can be disabled to reduce
1457                       the load on the LDAP server.  This flag is on by
1458                       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 injecting commands into the user's terminal
1467                       or running a background process that retains access to
1468                       the user's terminal device even after the main program
1469                       has finished executing.  By running the command in a
1470                       separate pseudo-pty, this attack is no longer possible.
1471                       This 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 above 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 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”, or
2176                   “pts/0”) sudo was run on, or “unknown” if there was no ter‐
2177                   minal 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, USER or USERNAME
2450     environment variables when running commands as root.  Additionally, on
2451     the machines in the SERVERS Host_Alias, we keep an additional local log
2452     file and make sure we log the year in each log line since the log entries
2453     will be kept around for several years.  Lastly, we disable shell escapes
2454     for 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               To enable noexec for a command, use the NOEXEC tag as docu‐
2669               mented in the User Specification section above.  Here is that
2670               example again:
2671
2672               aaron   shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
2673
2674               This allows user aaron to run /usr/bin/more and /usr/bin/vi
2675               with noexec enabled.  This will prevent those two commands from
2676               executing other commands (such as a shell).  If you are unsure
2677               whether or not your system is capable of supporting noexec you
2678               can always just try it out and check whether shell escapes work
2679               when noexec is enabled.
2680
2681     Note that restricting shell escapes is not a panacea.  Programs running
2682     as root are still capable of many potentially hazardous operations (such
2683     as changing or overwriting files) that could lead to unintended privilege
2684     escalation.  In the specific case of an editor, a safer approach is to
2685     give the user permission to run sudoedit (see below).
2686
2687   Secure editing
2688     The sudoers plugin includes sudoedit support which allows users to
2689     securely edit files with the editor of their choice.  As sudoedit is a
2690     built-in command, it must be specified in the sudoers file without a
2691     leading path.  However, it may take command line arguments just as a nor‐
2692     mal command does.  Wildcards used in sudoedit command line arguments are
2693     expected to be path names, so a forward slash (‘/’) will not be matched
2694     by a wildcard.
2695
2696     Unlike other sudo commands, the editor is run with the permissions of the
2697     invoking user and with the environment unmodified.  More information may
2698     be found in the description of the -e option in sudo(8).
2699
2700     For example, to allow user operator to edit the “message of the day”
2701     file:
2702
2703           operator        sudoedit /etc/motd
2704
2705     The operator user then runs sudoedit as follows:
2706
2707           $ sudoedit /etc/motd
2708
2709     The editor will run as the operator user, not root, on a temporary copy
2710     of /etc/motd.  After the file has been edited, /etc/motd will be updated
2711     with the contents of the temporary copy.
2712
2713     Users should never be granted sudoedit permission to edit a file that
2714     resides in a directory the user has write access to, either directly or
2715     via a wildcard.  If the user has write access to the directory it is pos‐
2716     sible to replace the legitimate file with a link to another file, allow‐
2717     ing the editing of arbitrary files.  To prevent this, starting with ver‐
2718     sion 1.8.16, symbolic links will not be followed in writable directories
2719     and sudoedit will refuse to edit a file located in a writable directory
2720     unless the sudoedit_checkdir option has been disabled or the invoking
2721     user is root.  Additionally, in version 1.8.15 and higher, sudoedit will
2722     refuse to open a symbolic link unless either the sudoedit_follow option
2723     is enabled or the sudoedit command is prefixed with the FOLLOW tag in the
2724     sudoers file.
2725
2726   Time stamp file checks
2727     sudoers will check the ownership of its time stamp directory
2728     (/run/sudo/ts by default) and ignore the directory's contents if it is
2729     not owned by root or if it is writable by a user other than root.  Older
2730     versions of sudo stored time stamp files in /tmp; this is no longer rec‐
2731     ommended as it may be possible for a user to create the time stamp them‐
2732     selves on systems that allow unprivileged users to change the ownership
2733     of files they create.
2734
2735     While the time stamp directory should be cleared at reboot time, not all
2736     systems contain a /run or /var/run directory.  To avoid potential prob‐
2737     lems, sudoers will ignore time stamp files that date from before the
2738     machine booted on systems where the boot time is available.
2739
2740     Some systems with graphical desktop environments allow unprivileged users
2741     to change the system clock.  Since sudoers relies on the system clock for
2742     time stamp validation, it may be possible on such systems for a user to
2743     run sudo for longer than timestamp_timeout by setting the clock back.  To
2744     combat this, sudoers uses a monotonic clock (which never moves backwards)
2745     for its time stamps if the system supports it.
2746
2747     sudoers will not honor time stamps set far in the future.  Time stamps
2748     with a date greater than current_time + 2 * TIMEOUT will be ignored and
2749     sudoers will log and complain.
2750
2751     If the timestamp_type option is set to “tty”, the time stamp record
2752     includes the device number of the terminal the user authenticated with.
2753     This provides per-terminal granularity but time stamp records may still
2754     outlive the user's session.
2755
2756     Unless the timestamp_type option is set to “global”, the time stamp
2757     record also includes the session ID of the process that last authenti‐
2758     cated.  This prevents processes in different terminal sessions from using
2759     the same time stamp record.  On systems where a process's start time can
2760     be queried, the start time of the session leader is recorded in the time
2761     stamp record.  If no terminal is present or the timestamp_type option is
2762     set to “ppid”, the start time of the parent process is used instead.  In
2763     most cases this will prevent a time stamp record from being re-used with‐
2764     out the user entering a password when logging out and back in again.
2765

DEBUGGING

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

SEE ALSO

2826     ssh(1), su(1), fnmatch(3), glob(3), mktemp(3), strftime(3), sudo.conf(5),
2827     sudo_plugin(5), sudoers.ldap(5), sudoers_timestamp(5), sudo(8), visudo(8)
2828

AUTHORS

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

CAVEATS

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

BUGS

2851     If you feel you have found a bug in sudo, please submit a bug report at
2852     https://bugzilla.sudo.ws/
2853

SUPPORT

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

DISCLAIMER

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