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

NAME

4     sudoers — default sudo security policy plugin
5

DESCRIPTION

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

SUDOERS FILE FORMAT

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

SUDOERS OPTIONS

999     sudo's behavior can be modified by Default_Entry lines, as explained ear‐
1000     lier.  A list of all supported Defaults parameters, grouped by type, are
1001     listed below.
1002
1003     Boolean Flags:
1004
1005     always_query_group_plugin
1006                       If a group_plugin is configured, use it to resolve
1007                       groups of the form %group as long as there is not also
1008                       a system group of the same name.  Normally, only groups
1009                       of the form %:group are passed to the group_plugin.
1010                       This flag is off by default.
1011
1012     always_set_home   If enabled, sudo will set the HOME environment variable
1013                       to the home directory of the target user (which is the
1014                       root user unless the -u option is used).  This flag is
1015                       largely obsolete and has no effect unless the env_reset
1016                       flag has been disabled or HOME is present in the
1017                       env_keep list, both of which are strongly discouraged.
1018                       This flag is off by default.
1019
1020     authenticate      If set, users must authenticate themselves via a pass‐
1021                       word (or other means of authentication) before they may
1022                       run commands.  This default may be overridden via the
1023                       PASSWD and NOPASSWD tags.  This flag is on by default.
1024
1025     case_insensitive_group
1026                       If enabled, group names in sudoers will be matched in a
1027                       case insensitive manner.  This may be necessary when
1028                       users are stored in LDAP or AD.  This flag is on by de‐
1029                       fault.
1030
1031     case_insensitive_user
1032                       If enabled, user names in sudoers will be matched in a
1033                       case insensitive manner.  This may be necessary when
1034                       groups are stored in LDAP or AD.  This flag is on by
1035                       default.
1036
1037     closefrom_override
1038                       If set, the user may use the -C option which overrides
1039                       the default starting point at which sudo begins closing
1040                       open file descriptors.  This flag is off by default.
1041
1042     compress_io       If set, and sudo is configured to log a command's input
1043                       or output, the I/O logs will be compressed using zlib.
1044                       This flag is on by default when sudo is compiled with
1045                       zlib support.
1046
1047     exec_background   By default, sudo runs a command as the foreground
1048                       process as long as sudo itself is running in the fore‐
1049                       ground.  When the exec_background flag is enabled and
1050                       the command is being run in a pseudo-terminal (due to
1051                       I/O logging or the use_pty flag), the command will be
1052                       run as a background process.  Attempts to read from the
1053                       controlling terminal (or to change terminal settings)
1054                       will result in the command being suspended with the
1055                       SIGTTIN signal (or SIGTTOU in the case of terminal set‐
1056                       tings).  If this happens when sudo is a foreground
1057                       process, the command will be granted the controlling
1058                       terminal and resumed in the foreground with no user in‐
1059                       tervention required.  The advantage of initially run‐
1060                       ning the command in the background is that sudo need
1061                       not read from the terminal unless the command explic‐
1062                       itly requests it.  Otherwise, any terminal input must
1063                       be passed to the command, whether it has required it or
1064                       not (the kernel buffers terminals so it is not possible
1065                       to tell whether the command really wants the input).
1066                       This is different from historic sudo behavior or when
1067                       the command is not being run in a pseudo-terminal.
1068
1069                       For this to work seamlessly, the operating system must
1070                       support the automatic restarting of system calls.  Un‐
1071                       fortunately, not all operating systems do this by de‐
1072                       fault, and even those that do may have bugs.  For exam‐
1073                       ple, macOS fails to restart the tcgetattr() and
1074                       tcsetattr() system calls (this is a bug in macOS).
1075                       Furthermore, because this behavior depends on the com‐
1076                       mand stopping with the SIGTTIN or SIGTTOU signals, pro‐
1077                       grams that catch these signals and suspend themselves
1078                       with a different signal (usually SIGTOP) will not be
1079                       automatically foregrounded.  Some versions of the linux
1080                       su(1) command behave this way.  This flag is off by de‐
1081                       fault.
1082
1083                       This setting is only supported by version 1.8.7 or
1084                       higher.  It has no effect unless I/O logging is enabled
1085                       or the use_pty flag is enabled.
1086
1087     env_editor        If set, visudo will use the value of the SUDO_EDITOR,
1088                       VISUAL or EDITOR environment variables before falling
1089                       back on the default editor list.  Note that visudo is
1090                       typically run as root so this flag may allow a user
1091                       with visudo privileges to run arbitrary commands as
1092                       root without logging.  An alternative is to place a
1093                       colon-separated list of “safe” editors int the editor
1094                       variable.  visudo will then only use SUDO_EDITOR,
1095                       VISUAL or EDITOR if they match a value specified in
1096                       editor.  If the env_reset flag is enabled, the
1097                       SUDO_EDITOR, VISUAL and/or EDITOR environment variables
1098                       must be present in the env_keep list for the env_editor
1099                       flag to function when visudo is invoked via sudo.  This
1100                       flag is on by default.
1101
1102     env_reset         If set, sudo will run the command in a minimal environ‐
1103                       ment containing the TERM, PATH, HOME, MAIL, SHELL,
1104                       LOGNAME, USER and SUDO_* variables.  Any variables in
1105                       the caller's environment or in the file specified by
1106                       the restricted_env_file setting that match the env_keep
1107                       and env_check lists are then added, followed by any
1108                       variables present in the file specified by the env_file
1109                       setting (if any).  The contents of the env_keep and
1110                       env_check lists, as modified by global Defaults parame‐
1111                       ters in sudoers, are displayed when sudo is run by root
1112                       with the -V option.  If the secure_path setting is en‐
1113                       abled, its value will be used for the PATH environment
1114                       variable.  This flag is on by default.
1115
1116     fast_glob         Normally, sudo uses the glob(3) function to do shell-
1117                       style globbing when matching path names.  However,
1118                       since it accesses the file system, glob(3) can take a
1119                       long time to complete for some patterns, especially
1120                       when the pattern references a network file system that
1121                       is mounted on demand (auto mounted).  The fast_glob
1122                       flag causes sudo to use the fnmatch(3) function, which
1123                       does not access the file system to do its matching.
1124                       The disadvantage of fast_glob is that it is unable to
1125                       match relative path names such as ./ls or ../bin/ls.
1126                       This has security implications when path names that in‐
1127                       clude globbing characters are used with the negation
1128                       operator, ‘!’, as such rules can be trivially bypassed.
1129                       As such, this flag should not be used when the sudoers
1130                       file contains rules that contain negated path names
1131                       which include globbing characters.  This flag is off by
1132                       default.
1133
1134     fqdn              Set this flag if you want to put fully qualified host
1135                       names in the sudoers file when the local host name (as
1136                       returned by the hostname command) does not contain the
1137                       domain name.  In other words, instead of myhost you
1138                       would use myhost.mydomain.edu.  You may still use the
1139                       short form if you wish (and even mix the two).  This
1140                       flag is only effective when the “canonical” host name,
1141                       as returned by the getaddrinfo() or gethostbyname()
1142                       function, is a fully-qualified domain name.  This is
1143                       usually the case when the system is configured to use
1144                       DNS for host name resolution.
1145
1146                       If the system is configured to use the /etc/hosts file
1147                       in preference to DNS, the “canonical” host name may not
1148                       be fully-qualified.  The order that sources are queried
1149                       for host name resolution is usually specified in the
1150                       /etc/nsswitch.conf, /etc/netsvc.conf, /etc/host.conf,
1151                       or, in some cases, /etc/resolv.conf file.  In the
1152                       /etc/hosts file, the first host name of the entry is
1153                       considered to be the “canonical” name; subsequent names
1154                       are aliases that are not used by sudoers.  For example,
1155                       the following hosts file line for the machine “xyzzy”
1156                       has the fully-qualified domain name as the “canonical”
1157                       host name, and the short version as an alias.
1158
1159                             192.168.1.1 xyzzy.sudo.ws xyzzy
1160
1161                       If the machine's hosts file entry is not formatted
1162                       properly, the fqdn flag will not be effective if it is
1163                       queried before DNS.
1164
1165                       Beware that when using DNS for host name resolution,
1166                       turning on fqdn requires sudoers to make DNS lookups
1167                       which renders sudo unusable if DNS stops working (for
1168                       example if the machine is disconnected from the net‐
1169                       work).  Also note that just like with the hosts file,
1170                       you must use the “canonical” name as DNS knows it.
1171                       That is, you may not use a host alias (CNAME entry) due
1172                       to performance issues and the fact that there is no way
1173                       to get all aliases from DNS.
1174
1175                       This flag is off by default.
1176
1177     ignore_audit_errors
1178                       Allow commands to be run even if sudoers cannot write
1179                       to the audit log.  If enabled, an audit log write fail‐
1180                       ure is not treated as a fatal error.  If disabled, a
1181                       command may only be run after the audit event is suc‐
1182                       cessfully written.  This flag is only effective on sys‐
1183                       tems for which sudoers supports audit logging, includ‐
1184                       ing FreeBSD, Linux, macOS and Solaris.  This flag is on
1185                       by default.
1186
1187     ignore_dot        If set, sudo will ignore "." or "" (both denoting cur‐
1188                       rent directory) in the PATH environment variable; the
1189                       PATH itself is not modified.  This flag is on by de‐
1190                       fault.
1191
1192     ignore_iolog_errors
1193                       Allow commands to be run even if sudoers cannot write
1194                       to the I/O log (local or remote).  If enabled, an I/O
1195                       log write failure is not treated as a fatal error.  If
1196                       disabled, the command will be terminated if the I/O log
1197                       cannot be written to.  This flag is off by default.
1198
1199     ignore_logfile_errors
1200                       Allow commands to be run even if sudoers cannot write
1201                       to the log file.  If enabled, a log file write failure
1202                       is not treated as a fatal error.  If disabled, a com‐
1203                       mand may only be run after the log file entry is suc‐
1204                       cessfully written.  This flag only has an effect when
1205                       sudoers is configured to use file-based logging via the
1206                       logfile setting.  This flag is on by default.
1207
1208     ignore_local_sudoers
1209                       If set via LDAP, parsing of /etc/sudoers will be
1210                       skipped.  This is intended for Enterprises that wish to
1211                       prevent the usage of local sudoers files so that only
1212                       LDAP is used.  This thwarts the efforts of rogue opera‐
1213                       tors who would attempt to add roles to /etc/sudoers.
1214                       When this flag is enabled, /etc/sudoers does not even
1215                       need to exist.  Since this flag tells sudo how to be‐
1216                       have when no specific LDAP entries have been matched,
1217                       this sudoOption is only meaningful for the cn=defaults
1218                       section.  This flag is off by default.
1219
1220     ignore_unknown_defaults
1221                       If set, sudo will not produce a warning if it encoun‐
1222                       ters an unknown Defaults entry in the sudoers file or
1223                       an unknown sudoOption in LDAP.  This flag is off by de‐
1224                       fault.
1225
1226     insults           If set, sudo will insult users when they enter an in‐
1227                       correct password.  This flag is off by default.
1228
1229     log_allowed       If set, sudoers will log commands allowed by the policy
1230                       to the system audit log (where supported) as well as to
1231                       syslog and/or a log file.  This flag is on by default.
1232
1233                       This setting is only supported by version 1.8.29 or
1234                       higher.
1235
1236     log_denied        If set, sudoers will log commands denied by the policy
1237                       to the system audit log (where supported) as well as to
1238                       syslog and/or a log file.  This flag is on by default.
1239
1240                       This setting is only supported by version 1.8.29 or
1241                       higher.
1242
1243     log_host          If set, the host name will be included in log entries
1244                       written to the file configured by the logfile setting.
1245                       This flag is off by default.
1246
1247     log_input         If set, sudo will run the command in a pseudo-terminal
1248                       and log all user input.  If the standard input is not
1249                       connected to the user's tty, due to I/O redirection or
1250                       because the command is part of a pipeline, that input
1251                       is also captured and stored in a separate log file.
1252                       Anything sent to the standard input will be consumed,
1253                       regardless of whether or not the command run via sudo
1254                       is actually reading the standard input.  This may have
1255                       unexpected results when using sudo in a shell script
1256                       that expects to process the standard input.  For more
1257                       information about I/O logging, see the I/O LOG FILES
1258                       section.  This flag is off by default.
1259
1260     log_output        If set, sudo will run the command in a pseudo-terminal
1261                       and log all output that is sent to the screen, similar
1262                       to the script(1) command.  For more information about
1263                       I/O logging, see the I/O LOG FILES section.  This flag
1264                       is off by default.
1265
1266     log_server_keepalive
1267                       If set, sudo will enable the TCP keepalive socket op‐
1268                       tion on the connection to the log server.  This enables
1269                       the periodic transmission of keepalive messages to the
1270                       server.  If the server does not respond to a message,
1271                       the connection will be closed and the running command
1272                       will be terminated unless the ignore_iolog_errors flag
1273                       (I/O logging enabled) or the ignore_log_errors flag
1274                       (I/O logging disabled) is set.  This flag is on by de‐
1275                       fault.
1276
1277                       This setting is only supported by version 1.9.0 or
1278                       higher.
1279
1280     log_server_verify
1281                       If set, the server certificate received during the TLS
1282                       handshake must be valid and it must contain either the
1283                       server name (from log_servers) or its IP address.  If
1284                       either of these conditions is not met, the TLS hand‐
1285                       shake will fail.  This flag is on by default.
1286
1287                       This setting is only supported by version 1.9.0 or
1288                       higher.
1289
1290     log_year          If set, the four-digit year will be logged in the (non-
1291                       syslog) sudo log file.  This flag is off by default.
1292
1293     long_otp_prompt   When validating with a One Time Password (OTP) scheme
1294                       such as S/Key or OPIE, a two-line prompt is used to
1295                       make it easier to cut and paste the challenge to a lo‐
1296                       cal window.  It's not as pretty as the default but some
1297                       people find it more convenient.  This flag is off by
1298                       default.
1299
1300     mail_all_cmnds    Send mail to the mailto user every time a user attempts
1301                       to run a command via sudo (this includes sudoedit).  No
1302                       mail will be sent if the user runs sudo with the -l or
1303                       -v option unless there is an authentication error and
1304                       the mail_badpass flag is also set.  This flag is off by
1305                       default.
1306
1307     mail_always       Send mail to the mailto user every time a user runs
1308                       sudo.  This flag is off by default.
1309
1310     mail_badpass      Send mail to the mailto user if the user running sudo
1311                       does not enter the correct password.  If the command
1312                       the user is attempting to run is not permitted by
1313                       sudoers and one of the mail_all_cmnds, mail_always,
1314                       mail_no_host, mail_no_perms or mail_no_user flags are
1315                       set, this flag will have no effect.  This flag is off
1316                       by default.
1317
1318     mail_no_host      If set, mail will be sent to the mailto user if the in‐
1319                       voking user exists in the sudoers file, but is not al‐
1320                       lowed to run commands on the current host.  This flag
1321                       is off by default.
1322
1323     mail_no_perms     If set, mail will be sent to the mailto user if the in‐
1324                       voking user is allowed to use sudo but the command they
1325                       are trying is not listed in their sudoers file entry or
1326                       is explicitly denied.  This flag is off by default.
1327
1328     mail_no_user      If set, mail will be sent to the mailto user if the in‐
1329                       voking user is not in the sudoers file.  This flag is
1330                       on by default.
1331
1332     match_group_by_gid
1333                       By default, sudoers will look up each group the user is
1334                       a member of by group-ID to determine the group name
1335                       (this is only done once).  The resulting list of the
1336                       user's group names is used when matching groups listed
1337                       in the sudoers file.  This works well on systems where
1338                       the number of groups listed in the sudoers file is
1339                       larger than the number of groups a typical user belongs
1340                       to.  On systems where group lookups are slow, where
1341                       users may belong to a large number of groups, and where
1342                       the number of groups listed in the sudoers file is rel‐
1343                       atively small, it may be prohibitively expensive and
1344                       running commands via sudo may take longer than normal.
1345                       On such systems it may be faster to use the
1346                       match_group_by_gid flag to avoid resolving the user's
1347                       group-IDs to group names.  In this case, sudoers must
1348                       look up any group name listed in the sudoers file and
1349                       use the group-ID instead of the group name when deter‐
1350                       mining whether the user is a member of the group.
1351
1352                       Note that if match_group_by_gid is enabled, group data‐
1353                       base lookups performed by sudoers will be keyed by
1354                       group name as opposed to group-ID.  On systems where
1355                       there are multiple sources for the group database, it
1356                       is possible to have conflicting group names or group-
1357                       IDs in the local /etc/group file and the remote group
1358                       database.  On such systems, enabling or disabling
1359                       match_group_by_gid can be used to choose whether group
1360                       database queries are performed by name (enabled) or ID
1361                       (disabled), which may aid in working around group entry
1362                       conflicts.
1363
1364                       The match_group_by_gid flag has no effect when sudoers
1365                       data is stored in LDAP.  This flag is off by default.
1366
1367                       This setting is only supported by version 1.8.18 or
1368                       higher.
1369
1370     netgroup_tuple    If set, netgroup lookups will be performed using the
1371                       full netgroup tuple: host name, user name and domain
1372                       (if one is set).  Historically, sudo only matched the
1373                       user name and domain for netgroups used in a User_List
1374                       and only matched the host name and domain for netgroups
1375                       used in a Host_List.  This flag is off by default.
1376
1377     noexec            If set, all commands run via sudo will behave as if the
1378                       NOEXEC tag has been set, unless overridden by an EXEC
1379                       tag.  See the description of EXEC and NOEXEC above as
1380                       well as the Preventing shell escapes section at the end
1381                       of this manual.  This flag is off by default.
1382
1383     pam_acct_mgmt     On systems that use PAM for authentication, sudo will
1384                       perform PAM account validation for the invoking user by
1385                       default.  The actual checks performed depend on which
1386                       PAM modules are configured.  If enabled, account vali‐
1387                       dation will be performed regardless of whether or not a
1388                       password is required.  This flag is on by default.
1389
1390                       This setting is only supported by version 1.8.28 or
1391                       higher.
1392
1393     pam_rhost         On systems that use PAM for authentication, sudo will
1394                       set the PAM remote host value to the name of the local
1395                       host when the pam_rhost flag is enabled.  On Linux sys‐
1396                       tems, enabling pam_rhost may result in DNS lookups of
1397                       the local host name when PAM is initialized.  On So‐
1398                       laris versions prior to Solaris 8, pam_rhost must be
1399                       enabled if pam_ruser is also enabled to avoid a crash
1400                       in the Solaris PAM implementation.
1401
1402                       This flag is off by default on systems other than So‐
1403                       laris.
1404
1405                       This setting is only supported by version 1.9.0 or
1406                       higher.
1407
1408     pam_ruser         On systems that use PAM for authentication, sudo will
1409                       set the PAM remote user value to the name of the user
1410                       that invoked sudo when the pam_ruser flag is enabled.
1411                       This flag is on by default.
1412
1413                       This setting is only supported by version 1.9.0 or
1414                       higher.
1415
1416     pam_session       On systems that use PAM for authentication, sudo will
1417                       create a new PAM session for the command to be run in.
1418                       Unless sudo is given the -i or -s options, PAM session
1419                       modules are run with the “silent” flag enabled.  This
1420                       prevents last login information from being displayed
1421                       for every command on some systems.  Disabling
1422                       pam_session may be needed on older PAM implementations
1423                       or on operating systems where opening a PAM session
1424                       changes the utmp or wtmp files.  If PAM session support
1425                       is disabled, resource limits may not be updated for the
1426                       command being run.  If pam_session, pam_setcred, and
1427                       use_pty are disabled, log_servers has not been set and
1428                       I/O logging has not been configured, sudo will execute
1429                       the command directly instead of running it as a child
1430                       process.  This flag is on by default.
1431
1432                       This setting is only supported by version 1.8.7 or
1433                       higher.
1434
1435     pam_setcred       On systems that use PAM for authentication, sudo will
1436                       attempt to establish credentials for the target user by
1437                       default, if supported by the underlying authentication
1438                       system.  One example of a credential is a Kerberos
1439                       ticket.  If pam_session, pam_setcred, and use_pty are
1440                       disabled, log_servers has not been set and I/O logging
1441                       has not been configured, sudo will execute the command
1442                       directly instead of running it as a child process.
1443                       This flag is on by default.
1444
1445                       This setting is only supported by version 1.8.8 or
1446                       higher.
1447
1448     passprompt_override
1449                       If set, the prompt specified by passprompt or the
1450                       SUDO_PROMPT environment variable will always be used
1451                       and will replace the prompt provided by a PAM module or
1452                       other authentication method.  This flag is off by de‐
1453                       fault.
1454
1455     path_info         Normally, sudo will tell the user when a command could
1456                       not be found in their PATH environment variable.  Some
1457                       sites may wish to disable this as it could be used to
1458                       gather information on the location of executables that
1459                       the normal user does not have access to.  The disadvan‐
1460                       tage is that if the executable is simply not in the
1461                       user's PATH, sudo will tell the user that they are not
1462                       allowed to run it, which can be confusing.  This flag
1463                       is on by default.
1464
1465     preserve_groups   By default, sudo will initialize the group vector to
1466                       the list of groups the target user is in.  When
1467                       preserve_groups is set, the user's existing group vec‐
1468                       tor is left unaltered.  The real and effective group-
1469                       IDs, however, are still set to match the target user.
1470                       This flag is off by default.
1471
1472     pwfeedback        By default, sudo reads the password like most other
1473                       Unix programs, by turning off echo until the user hits
1474                       the return (or enter) key.  Some users become confused
1475                       by this as it appears to them that sudo has hung at
1476                       this point.  When pwfeedback is set, sudo will provide
1477                       visual feedback when the user presses a key.  Note that
1478                       this does have a security impact as an onlooker may be
1479                       able to determine the length of the password being en‐
1480                       tered.  This flag is off by default.
1481
1482     requiretty        If set, sudo will only run when the user is logged in
1483                       to a real tty.  When this flag is set, sudo can only be
1484                       run from a login session and not via other means such
1485                       as cron(8) or cgi-bin scripts.  This flag is off by de‐
1486                       fault.
1487
1488     root_sudo         If set, root is allowed to run sudo too.  Disabling
1489                       this prevents users from “chaining” sudo commands to
1490                       get a root shell by doing something like “sudo sudo
1491                       /bin/sh”.  Note, however, that turning off root_sudo
1492                       will also prevent root from running sudoedit.  Dis‐
1493                       abling root_sudo provides no real additional security;
1494                       it exists purely for historical reasons.  This flag is
1495                       on by default.
1496
1497     rootpw            If set, sudo will prompt for the root password instead
1498                       of the password of the invoking user when running a
1499                       command or editing a file.  This flag is off by de‐
1500                       fault.
1501
1502     runas_allow_unknown_id
1503                       If enabled, allow matching of runas user and group IDs
1504                       that are not present in the password or group data‐
1505                       bases.  In addition to explicitly matching unknown user
1506                       or group IDs in a Runas_List, this option also allows
1507                       the ALL alias to match unknown IDs.  This flag is off
1508                       by default.
1509
1510                       This setting is only supported by version 1.8.30 or
1511                       higher.  Older versions of sudo always allowed matching
1512                       of unknown user and group IDs.
1513
1514     runas_check_shell
1515                       If enabled, sudo will only run commands as a user whose
1516                       shell appears in the /etc/shells file, even if the in‐
1517                       voking user's Runas_List would otherwise permit it.  If
1518                       no /etc/shells file is present, a system-dependent list
1519                       of built-in default shells is used.  On many operating
1520                       systems, system users such as “bin”, do not have a
1521                       valid shell and this flag can be used to prevent com‐
1522                       mands from being run as those users.  This flag is off
1523                       by default.
1524
1525                       This setting is only supported by version 1.8.30 or
1526                       higher.
1527
1528     runaspw           If set, sudo will prompt for the password of the user
1529                       defined by the runas_default option (defaults to root)
1530                       instead of the password of the invoking user when run‐
1531                       ning a command or editing a file.  This flag is off by
1532                       default.
1533
1534     selinux           If enabled, the user may specify an SELinux role and/or
1535                       type to use when running the command, as permitted by
1536                       the SELinux policy.  If SELinux is disabled on the sys‐
1537                       tem, this flag has no effect.  This flag is on by de‐
1538                       fault.
1539
1540     set_home          If enabled and sudo is invoked with the -s option, the
1541                       HOME environment variable will be set to the home di‐
1542                       rectory of the target user (which is the root user un‐
1543                       less the -u option is used).  This flag is largely ob‐
1544                       solete and has no effect unless the env_reset flag has
1545                       been disabled or HOME is present in the env_keep list,
1546                       both of which are strongly discouraged.  This flag is
1547                       off by default.
1548
1549     set_logname       Normally, sudo will set the LOGNAME and USER environ‐
1550                       ment variables to the name of the target user (usually
1551                       root unless the -u option is given).  However, since
1552                       some programs (including the RCS revision control sys‐
1553                       tem) use LOGNAME to determine the real identity of the
1554                       user, it may be desirable to change this behavior.
1555                       This can be done by negating the set_logname option.
1556                       Note that set_logname will have no effect if the
1557                       env_reset option has not been disabled and the env_keep
1558                       list contains LOGNAME or USER.  This flag is on by de‐
1559                       fault.
1560
1561     set_utmp          When enabled, sudo will create an entry in the utmp (or
1562                       utmpx) file when a pseudo-terminal is allocated.  A
1563                       pseudo-terminal is allocated by sudo when it is running
1564                       in a terminal and one or more of the log_input,
1565                       log_output or use_pty flags is enabled.  By default,
1566                       the new entry will be a copy of the user's existing
1567                       utmp entry (if any), with the tty, time, type and pid
1568                       fields updated.  This flag is on by default.
1569
1570     setenv            Allow the user to disable the env_reset option from the
1571                       command line via the -E option.  Additionally, environ‐
1572                       ment variables set via the command line are not subject
1573                       to the restrictions imposed by env_check, env_delete,
1574                       or env_keep.  As such, only trusted users should be al‐
1575                       lowed to set variables in this manner.  This flag is
1576                       off by default.
1577
1578     shell_noargs      If set and sudo is invoked with no arguments it acts as
1579                       if the -s option had been given.  That is, it runs a
1580                       shell as root (the shell is determined by the SHELL en‐
1581                       vironment variable if it is set, falling back on the
1582                       shell listed in the invoking user's /etc/passwd entry
1583                       if not).  This flag is off by default.
1584
1585     stay_setuid       Normally, when sudo executes a command the real and ef‐
1586                       fective UIDs are set to the target user (root by de‐
1587                       fault).  This option changes that behavior such that
1588                       the real UID is left as the invoking user's UID.  In
1589                       other words, this makes sudo act as a set-user-ID wrap‐
1590                       per.  This can be useful on systems that disable some
1591                       potentially dangerous functionality when a program is
1592                       run set-user-ID.  This option is only effective on sys‐
1593                       tems that support either the setreuid(2) or
1594                       setresuid(2) system call.  This flag is off by default.
1595
1596     sudoedit_checkdir
1597                       If set, sudoedit will check all directory components of
1598                       the path to be edited for writability by the invoking
1599                       user.  Symbolic links will not be followed in writable
1600                       directories and sudoedit will refuse to edit a file lo‐
1601                       cated in a writable directory.  These restrictions are
1602                       not enforced when sudoedit is run by root.  On some
1603                       systems, if all directory components of the path to be
1604                       edited are not readable by the target user, sudoedit
1605                       will be unable to edit the file.  This flag is on by
1606                       default.
1607
1608                       This setting was first introduced in version 1.8.15 but
1609                       initially suffered from a race condition.  The check
1610                       for symbolic links in writable intermediate directories
1611                       was added in version 1.8.16.
1612
1613     sudoedit_follow   By default, sudoedit will not follow symbolic links
1614                       when opening files.  The sudoedit_follow option can be
1615                       enabled to allow sudoedit to open symbolic links.  It
1616                       may be overridden on a per-command basis by the FOLLOW
1617                       and NOFOLLOW tags.  This flag is off by default.
1618
1619                       This setting is only supported by version 1.8.15 or
1620                       higher.
1621
1622     syslog_pid        When logging via syslog(3), include the process ID in
1623                       the log entry.  This flag is off by default.
1624
1625                       This setting is only supported by version 1.8.21 or
1626                       higher.
1627
1628     targetpw          If set, sudo will prompt for the password of the user
1629                       specified by the -u option (defaults to root) instead
1630                       of the password of the invoking user when running a
1631                       command or editing a file.  Note that this flag pre‐
1632                       cludes the use of a user-ID not listed in the passwd
1633                       database as an argument to the -u option.  This flag is
1634                       off by default.
1635
1636     tty_tickets       If set, users must authenticate on a per-tty basis.
1637                       With this flag enabled, sudo will use a separate record
1638                       in the time stamp file for each terminal.  If disabled,
1639                       a single record is used for all login sessions.
1640
1641                       This option has been superseded by the timestamp_type
1642                       option.
1643
1644     umask_override    If set, sudo will set the umask as specified in the
1645                       sudoers file without modification.  This makes it pos‐
1646                       sible to specify a umask in the sudoers file that is
1647                       more permissive than the user's own umask and matches
1648                       historical behavior.  If umask_override is not set,
1649                       sudo will set the umask to be the union of the user's
1650                       umask and what is specified in sudoers.  This flag is
1651                       off by default.
1652
1653     use_netgroups     If set, netgroups (prefixed with ‘+’), may be used in
1654                       place of a user or host.  For LDAP-based sudoers, net‐
1655                       group support requires an expensive sub-string match on
1656                       the server unless the NETGROUP_BASE directive is
1657                       present in the /etc/ldap.conf file.  If netgroups are
1658                       not needed, this option can be disabled to reduce the
1659                       load on the LDAP server.  This flag is on by default.
1660
1661     use_pty           If set, and sudo is running in a terminal, the command
1662                       will be run in a pseudo-terminal (even if no I/O log‐
1663                       ging is being done).  If the sudo process is not at‐
1664                       tached to a terminal, use_pty has no effect.
1665
1666                       A malicious program run under sudo may be capable of
1667                       injecting commands into the user's terminal or running
1668                       a background process that retains access to the user's
1669                       terminal device even after the main program has fin‐
1670                       ished executing.  By running the command in a separate
1671                       pseudo-terminal, this attack is no longer possible.
1672                       This flag is off by default.
1673
1674     user_command_timeouts
1675                       If set, the user may specify a timeout on the command
1676                       line.  If the timeout expires before the command has
1677                       exited, the command will be terminated.  If a timeout
1678                       is specified both in the sudoers file and on the com‐
1679                       mand line, the smaller of the two timeouts will be
1680                       used.  See the Timeout_Spec section for a description
1681                       of the timeout syntax.  This flag is off by default.
1682
1683                       This setting is only supported by version 1.8.20 or
1684                       higher.
1685
1686     utmp_runas        If set, sudo will store the name of the runas user when
1687                       updating the utmp (or utmpx) file.  By default, sudo
1688                       stores the name of the invoking user.  This flag is off
1689                       by default.
1690
1691     visiblepw         By default, sudo will refuse to run if the user must
1692                       enter a password but it is not possible to disable echo
1693                       on the terminal.  If the visiblepw flag is set, sudo
1694                       will prompt for a password even when it would be visi‐
1695                       ble on the screen.  This makes it possible to run
1696                       things like “ssh somehost sudo ls” since by default,
1697                       ssh(1) does not allocate a tty when running a command.
1698                       This flag is off by default.
1699
1700     Integers:
1701
1702     closefrom         Before it executes a command, sudo will close all open
1703                       file descriptors other than standard input, standard
1704                       output and standard error (ie: file descriptors 0-2).
1705                       The closefrom option can be used to specify a different
1706                       file descriptor at which to start closing.  The default
1707                       is 3.
1708
1709     command_timeout   The maximum amount of time a command is allowed to run
1710                       before it is terminated.  See the Timeout_Spec section
1711                       for a description of the timeout syntax.
1712
1713                       This setting is only supported by version 1.8.20 or
1714                       higher.
1715
1716     log_server_timeout
1717                       The maximum amount of time to wait when connecting to a
1718                       log server or waiting for a server response.  See the
1719                       Timeout_Spec section for a description of the timeout
1720                       syntax.  The default value is 30 seconds.
1721
1722                       This setting is only supported by version 1.9.0 or
1723                       higher.
1724
1725     maxseq            The maximum sequence number that will be substituted
1726                       for the “%{seq}” escape in the I/O log file (see the
1727                       iolog_dir description below for more information).
1728                       While the value substituted for “%{seq}” is in base 36,
1729                       maxseq itself should be expressed in decimal.  Values
1730                       larger than 2176782336 (which corresponds to the base
1731                       36 sequence number “ZZZZZZ”) will be silently truncated
1732                       to 2176782336.  The default value is 2176782336.
1733
1734                       Once the local sequence number reaches the value of
1735                       maxseq, it will “roll over” to zero, after which
1736                       sudoers will truncate and re-use any existing I/O log
1737                       path names.
1738
1739                       This setting is only supported by version 1.8.7 or
1740                       higher.
1741
1742     passwd_tries      The number of tries a user gets to enter his/her pass‐
1743                       word before sudo logs the failure and exits.  The de‐
1744                       fault is 3.
1745
1746     syslog_maxlen     On many systems, syslog(3) has a relatively small log
1747                       buffer.  IETF RFC 5424 states that syslog servers must
1748                       support messages of at least 480 bytes and should sup‐
1749                       port messages up to 2048 bytes.  By default, sudoers
1750                       creates log messages up to 980 bytes which corresponds
1751                       to the historic BSD syslog implementation which used a
1752                       1024 byte buffer to store the message, date, hostname
1753                       and program name.  To prevent syslog messages from be‐
1754                       ing truncated, sudoers will split up log messages that
1755                       are larger than syslog_maxlen bytes.  When a message is
1756                       split, additional parts will include the string
1757                       “(command continued)” after the user name and before
1758                       the continued command line arguments.
1759
1760                       This setting is only supported by version 1.8.19 or
1761                       higher.
1762
1763     Integers that can be used in a boolean context:
1764
1765     loglinelen        Number of characters per line for the file log.  This
1766                       value is used to decide when to wrap lines for nicer
1767                       log files.  This has no effect on the syslog log file,
1768                       only the file log.  The default is 80 (use 0 or negate
1769                       the option to disable word wrap).
1770
1771     passwd_timeout    Number of minutes before the sudo password prompt times
1772                       out, or 0 for no timeout.  The timeout may include a
1773                       fractional component if minute granularity is insuffi‐
1774                       cient, for example 2.5.  The default is 5.
1775
1776     timestamp_timeout
1777                       Number of minutes that can elapse before sudo will ask
1778                       for a passwd again.  The timeout may include a frac‐
1779                       tional component if minute granularity is insufficient,
1780                       for example 2.5.  The default is 5.  Set this to 0 to
1781                       always prompt for a password.  If set to a value less
1782                       than 0 the user's time stamp will not expire until the
1783                       system is rebooted.  This can be used to allow users to
1784                       create or delete their own time stamps via “sudo -v”
1785                       and “sudo -k” respectively.
1786
1787     umask             File mode creation mask to use when running the com‐
1788                       mand.  Negate this option or set it to 0777 to prevent
1789                       sudoers from changing the umask.  Unless the
1790                       umask_override flag is set, the actual umask will be
1791                       the union of the user's umask and the value of the
1792                       umask setting, which defaults to 0022.  This guarantees
1793                       that sudo never lowers the umask when running a com‐
1794                       mand.
1795
1796                       If umask is explicitly set in sudoers, it will override
1797                       any umask setting in PAM or login.conf.  If umask is
1798                       not set in sudoers, the umask specified by PAM or lo‐
1799                       gin.conf will take precedence.  The umask setting in
1800                       PAM is not used for sudoedit, which does not create a
1801                       new PAM session.
1802
1803     Strings:
1804
1805     authfail_message  Message that is displayed after a user fails to authen‐
1806                       ticate.  The message may include the ‘%d’ escape which
1807                       will expand to the number of failed password attempts.
1808                       If set, it overrides the default message, %d incorrect
1809                       password attempt(s).
1810
1811     badpass_message   Message that is displayed if a user enters an incorrect
1812                       password.  The default is Sorry, try again. unless in‐
1813                       sults are enabled.
1814
1815     editor            A colon (‘:’) separated list of editors path names used
1816                       by sudoedit and visudo.  For sudoedit, this list is
1817                       used to find an editor when none of the SUDO_EDITOR,
1818                       VISUAL or EDITOR environment variables are set to an
1819                       editor that exists and is executable.  For visudo, it
1820                       is used as a white list of allowed editors; visudo will
1821                       choose the editor that matches the user's SUDO_EDITOR,
1822                       VISUAL or EDITOR environment variable if possible, or
1823                       the first editor in the list that exists and is exe‐
1824                       cutable if not.  Unless invoked as sudoedit, sudo does
1825                       not preserve the SUDO_EDITOR, VISUAL or EDITOR environ‐
1826                       ment variables unless they are present in the env_keep
1827                       list or the env_reset option is disabled.  The default
1828                       is /bin/vi.
1829
1830     iolog_dir         The top-level directory to use when constructing the
1831                       path name for the input/output log directory.  Only
1832                       used if the log_input or log_output options are enabled
1833                       or when the LOG_INPUT or LOG_OUTPUT tags are present
1834                       for a command.  The session sequence number, if any, is
1835                       stored in the directory.  The default is
1836                       /var/log/sudo-io.
1837
1838                       The following percent (‘%’) escape sequences are sup‐
1839                       ported:
1840
1841                       %{seq}
1842                             expanded to a monotonically increasing base-36
1843                             sequence number, such as 0100A5, where every two
1844                             digits are used to form a new directory, e.g.,
1845                             01/00/A5
1846
1847                       %{user}
1848                             expanded to the invoking user's login name
1849
1850                       %{group}
1851                             expanded to the name of the invoking user's real
1852                             group-ID
1853
1854                       %{runas_user}
1855                             expanded to the login name of the user the com‐
1856                             mand will be run as (e.g., root)
1857
1858                       %{runas_group}
1859                             expanded to the group name of the user the com‐
1860                             mand will be run as (e.g., wheel)
1861
1862                       %{hostname}
1863                             expanded to the local host name without the do‐
1864                             main name
1865
1866                       %{command}
1867                             expanded to the base name of the command being
1868                             run
1869
1870                       In addition, any escape sequences supported by the sys‐
1871                       tem's strftime(3) function will be expanded.
1872
1873                       To include a literal ‘%’ character, the string ‘%%’
1874                       should be used.
1875
1876     iolog_file        The path name, relative to iolog_dir, in which to store
1877                       input/output logs when the log_input or log_output op‐
1878                       tions are enabled or when the LOG_INPUT or LOG_OUTPUT
1879                       tags are present for a command.  Note that iolog_file
1880                       may contain directory components.  The default is
1881                       “%{seq}”.
1882
1883                       See the iolog_dir option above for a list of supported
1884                       percent (‘%’) escape sequences.
1885
1886                       In addition to the escape sequences, path names that
1887                       end in six or more Xs will have the Xs replaced with a
1888                       unique combination of digits and letters, similar to
1889                       the mktemp(3) function.
1890
1891                       If the path created by concatenating iolog_dir and
1892                       iolog_file already exists, the existing I/O log file
1893                       will be truncated and overwritten unless iolog_file
1894                       ends in six or more Xs.
1895
1896     iolog_flush       If set, sudo will flush I/O log data to disk after each
1897                       write instead of buffering it.  This makes it possible
1898                       to view the logs in real-time as the program is execut‐
1899                       ing but may significantly reduce the effectiveness of
1900                       I/O log compression.  This flag is off by default.
1901
1902                       This setting is only supported by version 1.8.20 or
1903                       higher.
1904
1905     iolog_group       The group name to look up when setting the group-ID on
1906                       new I/O log files and directories.  If iolog_group is
1907                       not set, the primary group-ID of the user specified by
1908                       iolog_user is used.  If neither iolog_group nor
1909                       iolog_user are set, I/O log files and directories are
1910                       created with group-ID 0.
1911
1912                       This setting is only supported by version 1.8.19 or
1913                       higher.
1914
1915     iolog_mode        The file mode to use when creating I/O log files.  Mode
1916                       bits for read and write permissions for owner, group or
1917                       other are honored, everything else is ignored.  The
1918                       file permissions will always include the owner read and
1919                       write bits, even if they are not present in the speci‐
1920                       fied mode.  When creating I/O log directories, search
1921                       (execute) bits are added to match the read and write
1922                       bits specified by iolog_mode.  Defaults to 0600 (read
1923                       and write by user only).
1924
1925                       This setting is only supported by version 1.8.19 or
1926                       higher.
1927
1928     iolog_user        The user name to look up when setting the user and
1929                       group-IDs on new I/O log files and directories.  If
1930                       iolog_group is set, it will be used instead of the
1931                       user's primary group-ID.  By default, I/O log files and
1932                       directories are created with user and group-ID 0.
1933
1934                       This setting can be useful when the I/O logs are stored
1935                       on a Network File System (NFS) share.  Having a dedi‐
1936                       cated user own the I/O log files means that sudoers
1937                       does not write to the log files as user-ID 0, which is
1938                       usually not permitted by NFS.
1939
1940                       This setting is only supported by version 1.8.19 or
1941                       higher.
1942
1943     lecture_status_dir
1944                       The directory in which sudo stores per-user lecture
1945                       status files.  Once a user has received the lecture, a
1946                       zero-length file is created in this directory so that
1947                       sudo will not lecture the user again.  This directory
1948                       should not be cleared when the system reboots.  The de‐
1949                       fault is /var/db/sudo/lectured.
1950
1951     log_server_cabundle
1952                       The path to a certificate authority bundle file, in PEM
1953                       format, to use instead of the system's default certifi‐
1954                       cate authority database when authenticating the log
1955                       server.  The default is to use the system's default
1956                       certificate authority database.  This setting has no
1957                       effect unless log_servers is set and the remote log
1958                       server is secured with TLS.
1959
1960                       This setting is only supported by version 1.9.0 or
1961                       higher.
1962
1963     log_server_peer_cert
1964                       The path to the client's certificate file, in PEM for‐
1965                       mat.  This setting is required when log_servers is set
1966                       and the remote log server is secured with TLS.
1967
1968                       This setting is only supported by version 1.9.0 or
1969                       higher.
1970
1971     log_server_peer_key
1972                       The path to the client's private key file, in PEM for‐
1973                       mat.  This setting is required when log_servers is set
1974                       and the remote log server is secured with TLS.
1975
1976                       This setting is only supported by version 1.9.0 or
1977                       higher.
1978
1979     mailsub           Subject of the mail sent to the mailto user.  The es‐
1980                       cape %h will expand to the host name of the machine.
1981                       Default is “*** SECURITY information for %h ***”.
1982
1983     noexec_file       As of sudo version 1.8.1 this option is no longer sup‐
1984                       ported.  The path to the noexec file should now be set
1985                       in the sudo.conf(5) file.
1986
1987     pam_login_service
1988                       On systems that use PAM for authentication, this is the
1989                       service name used when the -i option is specified.  The
1990                       default value is “sudo-i”.  See the description of
1991                       pam_service for more information.
1992
1993                       This setting is only supported by version 1.8.8 or
1994                       higher.
1995
1996     pam_service       On systems that use PAM for authentication, the service
1997                       name specifies the PAM policy to apply.  This usually
1998                       corresponds to an entry in the pam.conf file or a file
1999                       in the /etc/pam.d directory.  The default value is
2000                       “sudo”.
2001
2002                       This setting is only supported by version 1.8.8 or
2003                       higher.
2004
2005     passprompt        The default prompt to use when asking for a password;
2006                       can be overridden via the -p option or the SUDO_PROMPT
2007                       environment variable.  The following percent (‘%’) es‐
2008                       cape sequences are supported:
2009
2010                       %H    expanded to the local host name including the do‐
2011                             main name (only if the machine's host name is
2012                             fully qualified or the fqdn option is set)
2013
2014                       %h    expanded to the local host name without the do‐
2015                             main name
2016
2017                       %p    expanded to the user whose password is being
2018                             asked for (respects the rootpw, targetpw and
2019                             runaspw flags in sudoers)
2020
2021                       %U    expanded to the login name of the user the com‐
2022                             mand will be run as (defaults to root)
2023
2024                       %u    expanded to the invoking user's login name
2025
2026                       %%    two consecutive % characters are collapsed into a
2027                             single % character
2028
2029                       On systems that use PAM for authentication, passprompt
2030                       will only be used if the prompt provided by the PAM
2031                       module matches the string “Password: ” or “username's
2032                       Password: ”.  This ensures that the passprompt setting
2033                       does not interfere with challenge-response style au‐
2034                       thentication.  The passprompt_override flag can be used
2035                       to change this behavior.
2036
2037                       The default value is “[sudo] password for %p: ”.
2038
2039     role              The default SELinux role to use when constructing a new
2040                       security context to run the command.  The default role
2041                       may be overridden on a per-command basis in the sudoers
2042                       file or via command line options.  This option is only
2043                       available when sudo is built with SELinux support.
2044
2045     runas_default     The default user to run commands as if the -u option is
2046                       not specified on the command line.  This defaults to
2047                       root.
2048
2049     sudoers_locale    Locale to use when parsing the sudoers file, logging
2050                       commands, and sending email.  Note that changing the
2051                       locale may affect how sudoers is interpreted.  Defaults
2052                       to “C”.
2053
2054     timestamp_type    sudoers uses per-user time stamp files for credential
2055                       caching.  The timestamp_type option can be used to
2056                       specify the type of time stamp record used.  It has the
2057                       following possible values:
2058
2059                       global  A single time stamp record is used for all of a
2060                               user's login sessions, regardless of the termi‐
2061                               nal or parent process ID.  An additional record
2062                               is used to serialize password prompts when sudo
2063                               is used multiple times in a pipeline, but this
2064                               does not affect authentication.
2065
2066                       ppid    A single time stamp record is used for all pro‐
2067                               cesses with the same parent process ID (usually
2068                               the shell).  Commands run from the same shell
2069                               (or other common parent process) will not re‐
2070                               quire a password for timestamp_timeout minutes
2071                               (5 by default).  Commands run via sudo with a
2072                               different parent process ID, for example from a
2073                               shell script, will be authenticated separately.
2074
2075                       tty     One time stamp record is used for each termi‐
2076                               nal, which means that a user's login sessions
2077                               are authenticated separately.  If no terminal
2078                               is present, the behavior is the same as ppid.
2079                               Commands run from the same terminal will not
2080                               require a password for timestamp_timeout min‐
2081                               utes (5 by default).
2082
2083                       kernel  The time stamp is stored in the kernel as an
2084                               attribute of the terminal device.  If no termi‐
2085                               nal is present, the behavior is the same as
2086                               ppid.  Negative timestamp_timeout values are
2087                               not supported and positive values are limited
2088                               to a maximum of 60 minutes.  This is currently
2089                               only supported on OpenBSD.
2090
2091                       The default value is tty.
2092
2093                       This setting is only supported by version 1.8.21 or
2094                       higher.
2095
2096     timestampdir      The directory in which sudo stores its time stamp
2097                       files.  This directory should be cleared when the sys‐
2098                       tem reboots.  The default is /run/sudo/ts.
2099
2100     timestampowner    The owner of the lecture status directory, time stamp
2101                       directory and all files stored therein.  The default is
2102                       root.
2103
2104     type              The default SELinux type to use when constructing a new
2105                       security context to run the command.  The default type
2106                       may be overridden on a per-command basis in the sudoers
2107                       file or via command line options.  This option is only
2108                       available when sudo is built with SELinux support.
2109
2110     Strings that can be used in a boolean context:
2111
2112     admin_flag    The admin_flag option specifies the path to a file that is
2113                   created the first time a user that is a member of the sudo
2114                   or admin groups runs sudo.  Only available if sudo is con‐
2115                   figured with the --enable-admin-flag option.  The default
2116                   value is ~/.sudo_as_admin_successful.
2117
2118     env_file      The env_file option specifies the fully qualified path to a
2119                   file containing variables to be set in the environment of
2120                   the program being run.  Entries in this file should either
2121                   be of the form “VARIABLE=value” or “export VARIABLE=value”.
2122                   The value may optionally be enclosed in single or double
2123                   quotes.  Variables in this file are only added if the vari‐
2124                   able does not already exist in the environment.  This file
2125                   is considered to be part of the security policy, its con‐
2126                   tents are not subject to other sudo environment restric‐
2127                   tions such as env_keep and env_check.
2128
2129     exempt_group  Users in this group are exempt from password and PATH re‐
2130                   quirements.  The group name specified should not include a
2131                   % prefix.  This is not set by default.
2132
2133     fdexec        Determines whether sudo will execute a command by its path
2134                   or by an open file descriptor.  It has the following possi‐
2135                   ble values:
2136
2137                   always  Always execute by file descriptor.
2138
2139                   never   Never execute by file descriptor.
2140
2141                   digest_only
2142                           Only execute by file descriptor if the command has
2143                           an associated digest in the sudoers file.
2144
2145                   The default value is digest_only.  This avoids a time of
2146                   check versus time of use race condition when the command is
2147                   located in a directory writable by the invoking user.
2148
2149                   Note that fdexec will change the first element of the argu‐
2150                   ment vector for scripts ($0 in the shell) due to the way
2151                   the kernel runs script interpreters.  Instead of being a
2152                   normal path, it will refer to a file descriptor.  For exam‐
2153                   ple, /dev/fd/4 on Solaris and /proc/self/fd/4 on Linux.  A
2154                   workaround is to use the SUDO_COMMAND environment variable
2155                   instead.
2156
2157                   The fdexec setting is only used when the command is matched
2158                   by path name.  It has no effect if the command is matched
2159                   by the built-in ALL alias.
2160
2161                   This setting is only supported by version 1.8.20 or higher.
2162                   If the operating system does not support the fexecve(2)
2163                   system call, this setting has no effect.
2164
2165     group_plugin  A string containing a sudoers group plugin with optional
2166                   arguments.  The string should consist of the plugin path,
2167                   either fully-qualified or relative to the /usr/libexec/sudo
2168                   directory, followed by any configuration arguments the
2169                   plugin requires.  These arguments (if any) will be passed
2170                   to the plugin's initialization function.  If arguments are
2171                   present, the string must be enclosed in double quotes ("").
2172
2173                   For more information see GROUP PROVIDER PLUGINS.
2174
2175     lecture       This option controls when a short lecture will be printed
2176                   along with the password prompt.  It has the following pos‐
2177                   sible values:
2178
2179                   always  Always lecture the user.
2180
2181                   never   Never lecture the user.
2182
2183                   once    Only lecture the user the first time they run sudo.
2184
2185                   If no value is specified, a value of once is implied.
2186                   Negating the option results in a value of never being used.
2187                   The default value is once.
2188
2189     lecture_file  Path to a file containing an alternate sudo lecture that
2190                   will be used in place of the standard lecture if the named
2191                   file exists.  By default, sudo uses a built-in lecture.
2192
2193     listpw        This option controls when a password will be required when
2194                   a user runs sudo with the -l option.  It has the following
2195                   possible values:
2196
2197                   all       All the user's sudoers file entries for the cur‐
2198                             rent host must have the NOPASSWD flag set to
2199                             avoid entering a password.
2200
2201                   always    The user must always enter a password to use the
2202                             -l option.
2203
2204                   any       At least one of the user's sudoers file entries
2205                             for the current host must have the NOPASSWD flag
2206                             set to avoid entering a password.
2207
2208                   never     The user need never enter a password to use the
2209                             -l option.
2210
2211                   If no value is specified, a value of any is implied.
2212                   Negating the option results in a value of never being used.
2213                   The default value is any.
2214
2215     log_format    The event log format.  Supported log formats are:
2216
2217                   json      Logs in JSON format.  JSON log entries contain
2218                             the full user details as well as the execution
2219                             environment if the command was allowed.  Due to
2220                             limitations of the protocol, JSON events sent via
2221                             syslog may be truncated.
2222
2223                   sudo      Traditional sudo-style logs, see LOG FORMAT for a
2224                             description of the log file format.
2225
2226                   This setting affects logs sent via syslog(3) as well as the
2227                   file specified by the logfile setting, if any.  The default
2228                   value is sudo.
2229
2230     logfile       Path to the sudo log file (not the syslog log file).  Set‐
2231                   ting a path turns on logging to a file; negating this op‐
2232                   tion turns it off.  By default, sudo logs via syslog.
2233
2234     mailerflags   Flags to use when invoking mailer.  Defaults to -t.
2235
2236     mailerpath    Path to mail program used to send warning mail.  Defaults
2237                   to the path to sendmail found at configure time.
2238
2239     mailfrom      Address to use for the “from” address when sending warning
2240                   and error mail.  The address should be enclosed in double
2241                   quotes ("") to protect against sudo interpreting the @
2242                   sign.  Defaults to the name of the user running sudo.
2243
2244     mailto        Address to send warning and error mail to.  The address
2245                   should be enclosed in double quotes ("") to protect against
2246                   sudo interpreting the @ sign.  Defaults to root.
2247
2248     restricted_env_file
2249                   The restricted_env_file option specifies the fully quali‐
2250                   fied path to a file containing variables to be set in the
2251                   environment of the program being run.  Entries in this file
2252                   should either be of the form “VARIABLE=value” or “export
2253                   VARIABLE=value”.  The value may optionally be enclosed in
2254                   single or double quotes.  Variables in this file are only
2255                   added if the variable does not already exist in the envi‐
2256                   ronment.  Unlike env_file, the file's contents are not
2257                   trusted and are processed in a manner similar to that of
2258                   the invoking user's environment.  If env_reset is enabled,
2259                   variables in the file will only be added if they are
2260                   matched by either the env_check or env_keep list.  If
2261                   env_reset is disabled, variables in the file are added as
2262                   long as they are not matched by the env_delete list.  In
2263                   either case, the contents of restricted_env_file are pro‐
2264                   cessed before the contents of env_file.
2265
2266     runchroot     If set, sudo will use this value for the root directory
2267                   when running a command.  The special value “*” will allow
2268                   the user to specify the root directory via sudo's -R op‐
2269                   tion.  See the Chroot_Spec section for more details.
2270
2271                   It is only possible to use runchroot as a command-specific
2272                   Defaults setting if the command exists with the same path
2273                   both inside and outside the chroot jail.  This restriction
2274                   does not apply to generic, host or user-based Defaults set‐
2275                   tings or to a Cmnd_Spec that includes a Chroot_Spec.
2276
2277                   This setting is only supported by version 1.9.3 or higher.
2278
2279     runcwd        If set, sudo will use this value for the working directory
2280                   when running a command.  The special value “*” will allow
2281                   the user to specify the working directory via sudo's -D op‐
2282                   tion.  See the Chdir_Spec section for more details.
2283
2284                   This setting is only supported by version 1.9.3 or higher.
2285
2286     secure_path   If set, sudo will use this value in place of the user's
2287                   PATH environment variable.  This option can be used to re‐
2288                   set the PATH to a known good value that contains directo‐
2289                   ries for system administrator commands such as /usr/sbin.
2290
2291                   Users in the group specified by the exempt_group option are
2292                   not affected by secure_path.  This option is not set by de‐
2293                   fault.
2294
2295     syslog        Syslog facility if syslog is being used for logging (negate
2296                   to disable syslog logging).  Defaults to authpriv.
2297
2298                   The following syslog facilities are supported: authpriv (if
2299                   your OS supports it), auth, daemon, user, local0, local1,
2300                   local2, local3, local4, local5, local6, and local7.
2301
2302     syslog_badpri
2303                   Syslog priority to use when the user is not allowed to run
2304                   a command or when authentication is unsuccessful.  Defaults
2305                   to alert.
2306
2307                   The following syslog priorities are supported: alert, crit,
2308                   debug, emerg, err, info, notice, warning, and none.  Negat‐
2309                   ing the option or setting it to a value of none will dis‐
2310                   able logging of unsuccessful commands.
2311
2312     syslog_goodpri
2313                   Syslog priority to use when the user is allowed to run a
2314                   command and authentication is successful.  Defaults to
2315                   notice.
2316
2317                   See syslog_badpri for the list of supported syslog priori‐
2318                   ties.  Negating the option or setting it to a value of none
2319                   will disable logging of successful commands.
2320
2321     verifypw      This option controls when a password will be required when
2322                   a user runs sudo with the -v option.  It has the following
2323                   possible values:
2324
2325                   all     All the user's sudoers file entries for the current
2326                           host must have the NOPASSWD flag set to avoid en‐
2327                           tering a password.
2328
2329                   always  The user must always enter a password to use the -v
2330                           option.
2331
2332                   any     At least one of the user's sudoers file entries for
2333                           the current host must have the NOPASSWD flag set to
2334                           avoid entering a password.
2335
2336                   never   The user need never enter a password to use the -v
2337                           option.
2338
2339                   If no value is specified, a value of all is implied.
2340                   Negating the option results in a value of never being used.
2341                   The default value is all.
2342
2343     Lists that can be used in a boolean context:
2344
2345     env_check         Environment variables to be removed from the user's en‐
2346                       vironment unless they are considered “safe”.  For all
2347                       variables except TZ, “safe” means that the variable's
2348                       value does not contain any ‘%’ or ‘/’ characters.  This
2349                       can be used to guard against printf-style format vul‐
2350                       nerabilities in poorly-written programs.  The TZ vari‐
2351                       able is considered unsafe if any of the following are
2352                       true:
2353
2354                       It consists of a fully-qualified path name, option‐
2355                          ally prefixed with a colon (‘:’), that does not
2356                          match the location of the zoneinfo directory.
2357
2358                       It contains a .. path element.
2359
2360                       It contains white space or non-printable characters.
2361
2362                       It is longer than the value of PATH_MAX.
2363
2364                       The argument may be a double-quoted, space-separated
2365                       list or a single value without double-quotes.  The list
2366                       can be replaced, added to, deleted from, or disabled by
2367                       using the =, +=, -=, and ! operators respectively.  Re‐
2368                       gardless of whether the env_reset option is enabled or
2369                       disabled, variables specified by env_check will be pre‐
2370                       served in the environment if they pass the aforemen‐
2371                       tioned check.  The global list of environment variables
2372                       to check is displayed when sudo is run by root with the
2373                       -V option.
2374
2375     env_delete        Environment variables to be removed from the user's en‐
2376                       vironment when the env_reset option is not in effect.
2377                       The argument may be a double-quoted, space-separated
2378                       list or a single value without double-quotes.  The list
2379                       can be replaced, added to, deleted from, or disabled by
2380                       using the =, +=, -=, and ! operators respectively.  The
2381                       global list of environment variables to remove is dis‐
2382                       played when sudo is run by root with the -V option.
2383                       Note that many operating systems will remove poten‐
2384                       tially dangerous variables from the environment of any
2385                       set-user-ID process (such as sudo).
2386
2387     env_keep          Environment variables to be preserved in the user's en‐
2388                       vironment when the env_reset option is in effect.  This
2389                       allows fine-grained control over the environment
2390                       sudo-spawned processes will receive.  The argument may
2391                       be a double-quoted, space-separated list or a single
2392                       value without double-quotes.  The list can be replaced,
2393                       added to, deleted from, or disabled by using the =, +=,
2394                       -=, and ! operators respectively.  The global list of
2395                       variables to keep is displayed when sudo is run by root
2396                       with the -V option.
2397
2398                       Preserving the HOME environment variable has security
2399                       implications since many programs use it when searching
2400                       for configuration or data files.  Adding HOME to
2401                       env_keep may enable a user to run unrestricted commands
2402                       via sudo and is strongly discouraged.  Users wishing to
2403                       edit files with sudo should run sudoedit (or sudo -e)
2404                       to get their accustomed editor configuration instead of
2405                       invoking the editor directly.
2406
2407     log_servers       A list of one or more servers to use for remote event
2408                       and I/O log storage, separated by white space.  Log
2409                       servers must be running sudo_logsrvd or another service
2410                       that implements the protocol described by
2411                       sudo_logsrv.proto(5).
2412
2413                       Server addresses should be of the form
2414                       “host[:port][(tls)]”.  The host portion may be a host
2415                       name, an IPv4 address, or an IPv6 address in square
2416                       brackets.
2417
2418                       If the optional tls flag is present, the connection
2419                       will be secured with Transport Layer Security (TLS)
2420                       version 1.2 or 1.3.  Versions of TLS prior to 1.2 are
2421                       not supported.
2422
2423                       If a port is specified, it may either be a port number
2424                       or a well-known service name as defined by the system
2425                       service name database.  If no port is specified, port
2426                       30343 will be used for plaintext connections and port
2427                       30344 will be used for TLS connections.
2428
2429                       When log_servers is set, event log data will be logged
2430                       both locally (see the syslog and log_file settings) as
2431                       well as remotely, but I/O log data will only be logged
2432                       remotely.  If multiple hosts are specified, they will
2433                       be attempted in reverse order.  If no log servers are
2434                       available, the user will not be able to run a command
2435                       unless either the ignore_iolog_errors flag (I/O logging
2436                       enabled) or the ignore_log_errors flag (I/O logging
2437                       disabled) is set.  Likewise, if the connection to the
2438                       log server is interrupted while sudo is running, the
2439                       command will be terminated unless the
2440                       ignore_iolog_errors flag (I/O logging enabled) or the
2441                       ignore_log_errors flag (I/O logging disabled) is set.
2442
2443                       This setting is only supported by version 1.9.0 or
2444                       higher.
2445

GROUP PROVIDER PLUGINS

2447     The sudoers plugin supports its own plugin interface to allow non-Unix
2448     group lookups which can query a group source other than the standard Unix
2449     group database.  This can be used to implement support for the
2450     nonunix_group syntax described earlier.
2451
2452     Group provider plugins are specified via the group_plugin setting.  The
2453     argument to group_plugin should consist of the plugin path, either fully-
2454     qualified or relative to the /usr/libexec/sudo directory, followed by any
2455     configuration options the plugin requires.  These options (if specified)
2456     will be passed to the plugin's initialization function.  If options are
2457     present, the string must be enclosed in double quotes ("").
2458
2459     The following group provider plugins are installed by default:
2460
2461     group_file
2462               The group_file plugin supports an alternate group file that
2463               uses the same syntax as the /etc/group file.  The path to the
2464               group file should be specified as an option to the plugin.  For
2465               example, if the group file to be used is /etc/sudo-group:
2466
2467               Defaults group_plugin="group_file.so /etc/sudo-group"
2468
2469     system_group
2470               The system_group plugin supports group lookups via the standard
2471               C library functions getgrnam() and getgrid().  This plugin can
2472               be used in instances where the user belongs to groups not
2473               present in the user's supplemental group vector.  This plugin
2474               takes no options:
2475
2476               Defaults group_plugin=system_group.so
2477
2478     The group provider plugin API is described in detail in sudo_plugin(5).
2479

LOG FORMAT

2481     sudoers can log events in either JSON or sudo format, this section de‐
2482     scribes the sudo log format.  Depending on sudoers configuration, sudoers
2483     can log events via syslog(3), to a local log file, or both.  The log for‐
2484     mat is almost identical in both cases.
2485
2486   Accepted command log entries
2487     Commands that sudo runs are logged using the following format (split into
2488     multiple lines for readability):
2489
2490         date hostname progname: username : TTY=ttyname ; PWD=cwd ; \
2491             USER=runasuser ; GROUP=runasgroup ; TSID=logid ; \
2492             ENV=env_vars COMMAND=command
2493
2494     Where the fields are as follows:
2495
2496     date          The date the command was run.  Typically, this is in the
2497                   format “MMM, DD, HH:MM:SS”.  If logging via syslog(3), the
2498                   actual date format is controlled by the syslog daemon.  If
2499                   logging to a file and the log_year option is enabled, the
2500                   date will also include the year.
2501
2502     hostname      The name of the host sudo was run on.  This field is only
2503                   present when logging via syslog(3).
2504
2505     progname      The name of the program, usually sudo or sudoedit.  This
2506                   field is only present when logging via syslog(3).
2507
2508     username      The login name of the user who ran sudo.
2509
2510     ttyname       The short name of the terminal (e.g., “console”, “tty01”,
2511                   or “pts/0”) sudo was run on, or “unknown” if there was no
2512                   terminal present.
2513
2514     cwd           The current working directory that sudo was run in.
2515
2516     runasuser     The user the command was run as.
2517
2518     runasgroup    The group the command was run as if one was specified on
2519                   the command line.
2520
2521     logid         An I/O log identifier that can be used to replay the com‐
2522                   mand's output.  This is only present when the log_input or
2523                   log_output option is enabled.
2524
2525     env_vars      A list of environment variables specified on the command
2526                   line, if specified.
2527
2528     command       The actual command that was executed.
2529
2530     Messages are logged using the locale specified by sudoers_locale, which
2531     defaults to the “C” locale.
2532
2533   Denied command log entries
2534     If the user is not allowed to run the command, the reason for the denial
2535     will follow the user name.  Possible reasons include:
2536
2537     user NOT in sudoers
2538       The user is not listed in the sudoers file.
2539
2540     user NOT authorized on host
2541       The user is listed in the sudoers file but is not allowed to run com‐
2542       mands on the host.
2543
2544     command not allowed
2545       The user is listed in the sudoers file for the host but they are not
2546       allowed to run the specified command.
2547
2548     3 incorrect password attempts
2549       The user failed to enter their password after 3 tries.  The actual num‐
2550       ber of tries will vary based on the number of failed attempts and the
2551       value of the passwd_tries option.
2552
2553     a password is required
2554       The -n option was specified but a password was required.
2555
2556     sorry, you are not allowed to set the following environment variables
2557       The user specified environment variables on the command line that were
2558       not allowed by sudoers.
2559
2560   Error log entries
2561     If an error occurs, sudoers will log a message and, in most cases, send a
2562     message to the administrator via email.  Possible errors include:
2563
2564     parse error in /etc/sudoers near line N
2565       sudoers encountered an error when parsing the specified file.  In some
2566       cases, the actual error may be one line above or below the line number
2567       listed, depending on the type of error.
2568
2569     problem with defaults entries
2570       The sudoers file contains one or more unknown Defaults settings.  This
2571       does not prevent sudo from running, but the sudoers file should be
2572       checked using visudo.
2573
2574     timestamp owner (username): No such user
2575       The time stamp directory owner, as specified by the timestampowner set‐
2576       ting, could not be found in the password database.
2577
2578     unable to open/read /etc/sudoers
2579       The sudoers file could not be opened for reading.  This can happen when
2580       the sudoers file is located on a remote file system that maps user-ID 0
2581       to a different value.  Normally, sudoers tries to open the sudoers file
2582       using group permissions to avoid this problem.  Consider either chang‐
2583       ing the ownership of /etc/sudoers or adding an argument like
2584       “sudoers_uid=N” (where ‘N’ is the user-ID that owns the sudoers file)
2585       to the end of the sudoers Plugin line in the sudo.conf(5) file.
2586
2587     unable to stat /etc/sudoers
2588       The /etc/sudoers file is missing.
2589
2590     /etc/sudoers is not a regular file
2591       The /etc/sudoers file exists but is not a regular file or symbolic
2592       link.
2593
2594     /etc/sudoers is owned by uid N, should be 0
2595       The sudoers file has the wrong owner.  If you wish to change the
2596       sudoers file owner, please add “sudoers_uid=N” (where ‘N’ is the user-
2597       ID that owns the sudoers file) to the sudoers Plugin line in the
2598       sudo.conf(5) file.
2599
2600     /etc/sudoers is world writable
2601       The permissions on the sudoers file allow all users to write to it.
2602       The sudoers file must not be world-writable, the default file mode is
2603       0440 (readable by owner and group, writable by none).  The default mode
2604       may be changed via the “sudoers_mode” option to the sudoers Plugin line
2605       in the sudo.conf(5) file.
2606
2607     /etc/sudoers is owned by gid N, should be 1
2608       The sudoers file has the wrong group ownership.  If you wish to change
2609       the sudoers file group ownership, please add “sudoers_gid=N” (where ‘N’
2610       is the group-ID that owns the sudoers file) to the sudoers Plugin line
2611       in the sudo.conf(5) file.
2612
2613     unable to open /run/sudo/ts/username
2614       sudoers was unable to read or create the user's time stamp file.  This
2615       can happen when timestampowner is set to a user other than root and the
2616       mode on /run/sudo is not searchable by group or other.  The default
2617       mode for /run/sudo is 0711.
2618
2619     unable to write to /run/sudo/ts/username
2620       sudoers was unable to write to the user's time stamp file.
2621
2622     /run/sudo/ts is owned by uid X, should be Y
2623       The time stamp directory is owned by a user other than timestampowner.
2624       This can occur when the value of timestampowner has been changed.
2625       sudoers will ignore the time stamp directory until the owner is cor‐
2626       rected.
2627
2628     /run/sudo/ts is group writable
2629       The time stamp directory is group-writable; it should be writable only
2630       by timestampowner.  The default mode for the time stamp directory is
2631       0700.  sudoers will ignore the time stamp directory until the mode is
2632       corrected.
2633
2634   Notes on logging via syslog
2635     By default, sudoers logs messages via syslog(3).  The date, hostname, and
2636     progname fields are added by the system's syslog() function, not sudoers
2637     itself.  As such, they may vary in format on different systems.
2638
2639     The maximum size of syslog messages varies from system to system.  The
2640     syslog_maxlen setting can be used to change the maximum syslog message
2641     size from the default value of 980 bytes.  For more information, see the
2642     description of syslog_maxlen.
2643
2644   Notes on logging to a file
2645     If the logfile option is set, sudoers will log to a local file, such as
2646     /var/log/sudo.  When logging to a file, sudoers uses a format similar to
2647     syslog(3), with a few important differences:
2648
2649     1.   The progname and hostname fields are not present.
2650
2651     2.   If the log_year option is enabled, the date will also include the
2652          year.
2653
2654     3.   Lines that are longer than loglinelen characters (80 by default) are
2655          word-wrapped and continued on the next line with a four character
2656          indent.  This makes entries easier to read for a human being, but
2657          makes it more difficult to use grep(1) on the log files.  If the
2658          loglinelen option is set to 0 (or negated with a ‘!’), word wrap
2659          will be disabled.
2660

I/O LOG FILES

2662     When I/O logging is enabled, sudo will run the command in a pseudo-termi‐
2663     nal and log all user input and/or output, depending on which options are
2664     enabled.  I/O can be logged either to the local machine or to a remote
2665     log server.  For local logs, I/O is logged to the directory specified by
2666     the iolog_dir option (/var/log/sudo-io by default) using a unique session
2667     ID that is included in the sudo log line, prefixed with “TSID=”.  The
2668     iolog_file option may be used to control the format of the session ID.
2669     For remote logs, the log_servers setting is used to specify one or more
2670     log servers running sudo_logsrvd or another server that implements the
2671     protocol described by sudo_logsrv.proto(5).
2672
2673     For both local and remote I/O logs, each log is stored in a separate di‐
2674     rectory that contains the following files:
2675
2676     log       A text file containing information about the command.  The
2677               first line consists of the following colon-delimited fields:
2678               the time the command was run, the name of the user who ran
2679               sudo, the name of the target user, the name of the target group
2680               (optional), the terminal that sudo was run from, and the number
2681               of lines and columns of the terminal.  The second and third
2682               lines contain the working directory the command was run from
2683               and the path name of the command itself (with arguments if
2684               present).
2685
2686     log.json  A JSON-formatted file containing information about the command.
2687               This is similar to the log file but contains additional infor‐
2688               mation and is easily extensible.  The log.json file will be
2689               used by sudoreplay(8) in preference to the log file if it ex‐
2690               ists.  The file may contain the following elements:
2691
2692               timestamp
2693                         A JSON object containing time the command was run.
2694                         It consists of two values, seconds and nanoseconds.
2695
2696               columns   The number of columns of the terminal the command ran
2697                         on, or zero if no terminal was present.
2698
2699               command   The fully-qualified path of the command that was run.
2700
2701               lines     The number of lines of the terminal the command ran
2702                         on, or zero if no terminal was present.
2703
2704               runargv   A JSON array representing the command's argument vec‐
2705                         tor as passed to the execve(2) system call.
2706
2707               runenv    A JSON array representing the command's environment
2708                         as passed to the execve(2) system call.
2709
2710               rungid    The group ID the command ran as.  This element is
2711                         only present when the user specifies a group on the
2712                         command line.
2713
2714               rungroup  The name of the group the command ran as.  This ele‐
2715                         ment is only present when the user specifies a group
2716                         on the command line.
2717
2718               runuid    The user ID the command ran as.
2719
2720               runuser   The name of the user the command ran as.
2721
2722               submitcwd
2723                         The current working directory at the time sudo was
2724                         run.
2725
2726               submithost
2727                         The name of the host the command was run on.
2728
2729               submituser
2730                         The name of the user who ran the command via sudo.
2731
2732               ttyname   The path name of the terminal the user invoked sudo
2733                         from.  If the command was run in a pseudo-terminal,
2734                         ttyname will be different from the terminal the com‐
2735                         mand actually ran in.
2736
2737     timing    Timing information used to replay the session.  Each line con‐
2738               sists of the I/O log entry type and amount of time since the
2739               last entry, followed by type-specific data.  The I/O log entry
2740               types and their corresponding type-specific data are:
2741
2742               0     standard input, number of bytes in the entry
2743               1     standard output, number of bytes in the entry
2744               2     standard error, number of bytes in the entry
2745               3     terminal input, number of bytes in the entry
2746               4     terminal output, number of bytes in the entry
2747               5     window change, new number lines and columns
2748               6     bug compatibility for sudo 1.8.7 terminal output
2749               7     command suspend or resume, signal received
2750
2751     ttyin     Raw input from the user's terminal, exactly as it was received.
2752               No post-processing is performed.  For manual viewing, you may
2753               wish to convert carriage return characters in the log to line
2754               feeds.  For example: ‘gunzip -c ttyin | tr "\r" "\n"’
2755
2756     stdin     The standard input when no terminal is present, or input redi‐
2757               rected from a pipe or file.
2758
2759     ttyout    Output from the pseudo-terminal (what the command writes to the
2760               screen).  Note that terminal-specific post-processing is per‐
2761               formed before the data is logged.  This means that, for exam‐
2762               ple, line feeds are usually converted to line feed/carriage re‐
2763               turn pairs and tabs may be expanded to spaces.
2764
2765     stdout    The standard output when no terminal is present, or output
2766               redirected to a pipe or file.
2767
2768     stderr    The standard error redirected to a pipe or file.
2769
2770     All files other than log are compressed in gzip format unless the
2771     compress_io flag has been disabled.  Due to buffering, it is not normally
2772     possible to display the I/O logs in real-time as the program is execut‐
2773     ing.  The I/O log data will not be complete until the program run by sudo
2774     has exited or has been terminated by a signal.  The iolog_flush flag can
2775     be used to disable buffering, in which case I/O log data is written to
2776     disk as soon as it is available.  The output portion of an I/O log file
2777     can be viewed with the sudoreplay(8) utility, which can also be used to
2778     list or search the available logs.
2779
2780     Note that user input may contain sensitive information such as passwords
2781     (even if they are not echoed to the screen), which will be stored in the
2782     log file unencrypted.  In most cases, logging the command output via
2783     log_output or LOG_OUTPUT is all that is required.
2784
2785     Since each session's I/O logs are stored in a separate directory, tradi‐
2786     tional log rotation utilities cannot be used to limit the number of I/O
2787     logs.  The simplest way to limit the number of I/O is by setting the
2788     maxseq option to the maximum number of logs you wish to store.  Once the
2789     I/O log sequence number reaches maxseq, it will be reset to zero and
2790     sudoers will truncate and re-use any existing I/O logs.
2791

FILES

2793     /etc/sudo.conf            Sudo front end configuration
2794
2795     /etc/sudoers              List of who can run what
2796
2797     /etc/group                Local groups file
2798
2799     /etc/netgroup             List of network groups
2800
2801     /var/log/sudo-io          I/O log files
2802
2803     /run/sudo/ts              Directory containing time stamps for the
2804                               sudoers security policy
2805
2806     /var/db/sudo/lectured     Directory containing lecture status files for
2807                               the sudoers security policy
2808
2809     /etc/environment          Initial environment for -i mode on AIX and
2810                               Linux systems
2811

EXAMPLES

2813     Below are example sudoers file entries.  Admittedly, some of these are a
2814     bit contrived.  First, we allow a few environment variables to pass and
2815     then define our aliases:
2816
2817     # Run X applications through sudo; HOME is used to find the
2818     # .Xauthority file.  Note that other programs use HOME to find
2819     # configuration files and this may lead to privilege escalation!
2820     Defaults env_keep += "DISPLAY HOME"
2821
2822     # User alias specification
2823     User_Alias      FULLTIMERS = millert, mikef, dowdy
2824     User_Alias      PARTTIMERS = bostley, jwfox, crawl
2825     User_Alias      WEBADMIN = will, wendy, wim
2826
2827     # Runas alias specification
2828     Runas_Alias     OP = root, operator
2829     Runas_Alias     DB = oracle, sybase
2830     Runas_Alias     ADMINGRP = adm, oper
2831
2832     # Host alias specification
2833     Host_Alias      SPARC = bigtime, eclipse, moet, anchor :\
2834                     SGI = grolsch, dandelion, black :\
2835                     ALPHA = widget, thalamus, foobar :\
2836                     HPPA = boa, nag, python
2837     Host_Alias      CUNETS = 128.138.0.0/255.255.0.0
2838     Host_Alias      CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
2839     Host_Alias      SERVERS = primary, mail, www, ns
2840     Host_Alias      CDROM = orion, perseus, hercules
2841
2842     # Cmnd alias specification
2843     Cmnd_Alias      DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\
2844                             /usr/sbin/restore, /usr/sbin/rrestore,\
2845                             sha224:0GomF8mNN3wlDt1HD9XldjJ3SNgpFdbjO1+NsQ== \
2846                             /home/operator/bin/start_backups
2847     Cmnd_Alias      KILL = /usr/bin/kill
2848     Cmnd_Alias      PRINTING = /usr/sbin/lpc, /usr/bin/lprm
2849     Cmnd_Alias      SHUTDOWN = /usr/sbin/shutdown
2850     Cmnd_Alias      HALT = /usr/sbin/halt
2851     Cmnd_Alias      REBOOT = /usr/sbin/reboot
2852     Cmnd_Alias      SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh,\
2853                              /usr/local/bin/tcsh, /usr/bin/rsh,\
2854                              /usr/local/bin/zsh
2855     Cmnd_Alias      SU = /usr/bin/su
2856     Cmnd_Alias      PAGERS = /usr/bin/more, /usr/bin/pg, /usr/bin/less
2857
2858     Here we override some of the compiled in default values.  We want sudo to
2859     log via syslog(3) using the auth facility in all cases and for commands
2860     to be run with the target user's home directory as the working directory.
2861     We don't want to subject the full time staff to the sudo lecture and we
2862     want to allow them to run commands in a chroot(2) “sandbox” via the -R
2863     option.  User millert need not provide a password and we don't want to
2864     reset the LOGNAME or USER environment variables when running commands as
2865     root.  Additionally, on the machines in the SERVERS Host_Alias, we keep
2866     an additional local log file and make sure we log the year in each log
2867     line since the log entries will be kept around for several years.
2868     Lastly, we disable shell escapes for the commands in the PAGERS
2869     Cmnd_Alias (/usr/bin/more, /usr/bin/pg and /usr/bin/less).  Note that
2870     this will not effectively constrain users with sudo ALL privileges.
2871
2872     # Override built-in defaults
2873     Defaults                syslog=auth,runcwd=~
2874     Defaults>root           !set_logname
2875     Defaults:FULLTIMERS     !lecture,runchroot=*
2876     Defaults:millert        !authenticate
2877     Defaults@SERVERS        log_year, logfile=/var/log/sudo.log
2878     Defaults!PAGERS         noexec
2879
2880     The User specification is the part that actually determines who may run
2881     what.
2882
2883     root            ALL = (ALL) ALL
2884     %wheel          ALL = (ALL) ALL
2885
2886     We let root and any user in group wheel run any command on any host as
2887     any user.
2888
2889     FULLTIMERS      ALL = NOPASSWD: ALL
2890
2891     Full time sysadmins (millert, mikef, and dowdy) may run any command on
2892     any host without authenticating themselves.
2893
2894     PARTTIMERS      ALL = ALL
2895
2896     Part time sysadmins bostley, jwfox, and crawl) may run any command on any
2897     host but they must authenticate themselves first (since the entry lacks
2898     the NOPASSWD tag).
2899
2900     jack            CSNETS = ALL
2901
2902     The user jack may run any command on the machines in the CSNETS alias
2903     (the networks 128.138.243.0, 128.138.204.0, and 128.138.242.0).  Of those
2904     networks, only 128.138.204.0 has an explicit netmask (in CIDR notation)
2905     indicating it is a class C network.  For the other networks in CSNETS,
2906     the local machine's netmask will be used during matching.
2907
2908     lisa            CUNETS = ALL
2909
2910     The user lisa may run any command on any host in the CUNETS alias (the
2911     class B network 128.138.0.0).
2912
2913     operator        ALL = DUMPS, KILL, SHUTDOWN, HALT, REBOOT, PRINTING,\
2914                     sudoedit /etc/printcap, /usr/oper/bin/
2915
2916     The operator user may run commands limited to simple maintenance.  Here,
2917     those are commands related to backups, killing processes, the printing
2918     system, shutting down the system, and any commands in the directory
2919     /usr/oper/bin/.  Note that one command in the DUMPS Cmnd_Alias includes a
2920     sha224 digest, /home/operator/bin/start_backups.  This is because the di‐
2921     rectory containing the script is writable by the operator user.  If the
2922     script is modified (resulting in a digest mismatch) it will no longer be
2923     possible to run it via sudo.
2924
2925     joe             ALL = /usr/bin/su operator
2926
2927     The user joe may only su(1) to operator.
2928
2929     pete            HPPA = /usr/bin/passwd [A-Za-z]*, !/usr/bin/passwd *root*
2930
2931     %opers          ALL = (: ADMINGRP) /usr/sbin/
2932
2933     Users in the opers group may run commands in /usr/sbin/ as themselves
2934     with any group in the ADMINGRP Runas_Alias (the adm and oper groups).
2935
2936     The user pete is allowed to change anyone's password except for root on
2937     the HPPA machines.  Because command line arguments are matched as a sin‐
2938     gle, concatenated string, the ‘*’ wildcard will match multiple words.
2939     This example assumes that passwd(1) does not take multiple user names on
2940     the command line.  Note that on GNU systems, options to passwd(1) may be
2941     specified after the user argument.  As a result, this rule will also al‐
2942     low:
2943
2944         passwd username --expire
2945
2946     which may not be desirable.
2947
2948     bob             SPARC = (OP) ALL : SGI = (OP) ALL
2949
2950     The user bob may run anything on the SPARC and SGI machines as any user
2951     listed in the OP Runas_Alias (root and operator.)
2952
2953     jim             +biglab = ALL
2954
2955     The user jim may run any command on machines in the biglab netgroup.
2956     sudo knows that “biglab” is a netgroup due to the ‘+’ prefix.
2957
2958     +secretaries    ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser
2959
2960     Users in the secretaries netgroup need to help manage the printers as
2961     well as add and remove users, so they are allowed to run those commands
2962     on all machines.
2963
2964     fred            ALL = (DB) NOPASSWD: ALL
2965
2966     The user fred can run commands as any user in the DB Runas_Alias (oracle
2967     or sybase) without giving a password.
2968
2969     john            ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*
2970
2971     On the ALPHA machines, user john may su to anyone except root but he is
2972     not allowed to specify any options to the su(1) command.
2973
2974     jen             ALL, !SERVERS = ALL
2975
2976     The user jen may run any command on any machine except for those in the
2977     SERVERS Host_Alias (primary, mail, www and ns).
2978
2979     jill            SERVERS = /usr/bin/, !SU, !SHELLS
2980
2981     For any machine in the SERVERS Host_Alias, jill may run any commands in
2982     the directory /usr/bin/ except for those commands belonging to the SU and
2983     SHELLS Cmnd_Aliases.  While not specifically mentioned in the rule, the
2984     commands in the PAGERS Cmnd_Alias all reside in /usr/bin and have the
2985     noexec option set.
2986
2987     steve           CSNETS = (operator) /usr/local/op_commands/
2988
2989     The user steve may run any command in the directory /usr/local/op_com‐
2990     mands/ but only as user operator.
2991
2992     matt            valkyrie = KILL
2993
2994     On his personal workstation, valkyrie, matt needs to be able to kill hung
2995     processes.
2996
2997     WEBADMIN        www = (www) ALL, (root) /usr/bin/su www
2998
2999     On the host www, any user in the WEBADMIN User_Alias (will, wendy, and
3000     wim), may run any command as user www (which owns the web pages) or sim‐
3001     ply su(1) to www.
3002
3003     ALL             CDROM = NOPASSWD: /sbin/umount /CDROM,\
3004                     /sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM
3005
3006     Any user may mount or unmount a CD-ROM on the machines in the CDROM
3007     Host_Alias (orion, perseus, hercules) without entering a password.  This
3008     is a bit tedious for users to type, so it is a prime candidate for encap‐
3009     sulating in a shell script.
3010

SECURITY NOTES

3012   Limitations of the ‘!’ operator
3013     It is generally not effective to “subtract” commands from ALL using the
3014     ‘!’ operator.  A user can trivially circumvent this by copying the de‐
3015     sired command to a different name and then executing that.  For example:
3016
3017     bill    ALL = ALL, !SU, !SHELLS
3018
3019     Doesn't really prevent bill from running the commands listed in SU or
3020     SHELLS since he can simply copy those commands to a different name, or
3021     use a shell escape from an editor or other program.  Therefore, these
3022     kind of restrictions should be considered advisory at best (and rein‐
3023     forced by policy).
3024
3025     In general, if a user has sudo ALL there is nothing to prevent them from
3026     creating their own program that gives them a root shell (or making their
3027     own copy of a shell) regardless of any ‘!’ elements in the user specifi‐
3028     cation.
3029
3030   Security implications of fast_glob
3031     If the fast_glob option is in use, it is not possible to reliably negate
3032     commands where the path name includes globbing (aka wildcard) characters.
3033     This is because the C library's fnmatch(3) function cannot resolve rela‐
3034     tive paths.  While this is typically only an inconvenience for rules that
3035     grant privileges, it can result in a security issue for rules that sub‐
3036     tract or revoke privileges.
3037
3038     For example, given the following sudoers file entry:
3039
3040     john    ALL = /usr/bin/passwd [a-zA-Z0-9]*, /usr/bin/chsh [a-zA-Z0-9]*,\
3041                   /usr/bin/chfn [a-zA-Z0-9]*, !/usr/bin/* root
3042
3043     User john can still run /usr/bin/passwd root if fast_glob is enabled by
3044     changing to /usr/bin and running ./passwd root instead.
3045
3046   Preventing shell escapes
3047     Once sudo executes a program, that program is free to do whatever it
3048     pleases, including run other programs.  This can be a security issue
3049     since it is not uncommon for a program to allow shell escapes, which lets
3050     a user bypass sudo's access control and logging.  Common programs that
3051     permit shell escapes include shells (obviously), editors, paginators,
3052     mail and terminal programs.
3053
3054     There are two basic approaches to this problem:
3055
3056     restrict  Avoid giving users access to commands that allow the user to
3057               run arbitrary commands.  Many editors have a restricted mode
3058               where shell escapes are disabled, though sudoedit is a better
3059               solution to running editors via sudo.  Due to the large number
3060               of programs that offer shell escapes, restricting users to the
3061               set of programs that do not is often unworkable.
3062
3063     noexec    Many systems that support shared libraries have the ability to
3064               override default library functions by pointing an environment
3065               variable (usually LD_PRELOAD) to an alternate shared library.
3066               On such systems, sudo's noexec functionality can be used to
3067               prevent a program run by sudo from executing any other pro‐
3068               grams.  Note, however, that this applies only to dynamically-
3069               linked executables.  Statically-linked executables and executa‐
3070               bles running under binary emulation are not affected.
3071
3072               The noexec feature is known to work on SunOS, Solaris, *BSD,
3073               Linux, IRIX, Tru64 UNIX, macOS, HP-UX 11.x and AIX 5.3 and
3074               above.  It should be supported on most operating systems that
3075               support the LD_PRELOAD environment variable.  Check your oper‐
3076               ating system's manual pages for the dynamic linker (usually
3077               ld.so, ld.so.1, dyld, dld.sl, rld, or loader) to see if
3078               LD_PRELOAD is supported.
3079
3080               On Solaris 10 and higher, noexec uses Solaris privileges in‐
3081               stead of the LD_PRELOAD environment variable.
3082
3083               To enable noexec for a command, use the NOEXEC tag as docu‐
3084               mented in the User Specification section above.  Here is that
3085               example again:
3086
3087               aaron   shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
3088
3089               This allows user aaron to run /usr/bin/more and /usr/bin/vi
3090               with noexec enabled.  This will prevent those two commands from
3091               executing other commands (such as a shell).  If you are unsure
3092               whether or not your system is capable of supporting noexec you
3093               can always just try it out and check whether shell escapes work
3094               when noexec is enabled.
3095
3096     Note that restricting shell escapes is not a panacea.  Programs running
3097     as root are still capable of many potentially hazardous operations (such
3098     as changing or overwriting files) that could lead to unintended privilege
3099     escalation.  In the specific case of an editor, a safer approach is to
3100     give the user permission to run sudoedit (see below).
3101
3102   Secure editing
3103     The sudoers plugin includes sudoedit support which allows users to se‐
3104     curely edit files with the editor of their choice.  As sudoedit is a
3105     built-in command, it must be specified in the sudoers file without a
3106     leading path.  However, it may take command line arguments just as a nor‐
3107     mal command does.  Wildcards used in sudoedit command line arguments are
3108     expected to be path names, so a forward slash (‘/’) will not be matched
3109     by a wildcard.
3110
3111     Unlike other sudo commands, the editor is run with the permissions of the
3112     invoking user and with the environment unmodified.  More information may
3113     be found in the description of the -e option in sudo(8).
3114
3115     For example, to allow user operator to edit the “message of the day”
3116     file:
3117
3118           operator        sudoedit /etc/motd
3119
3120     The operator user then runs sudoedit as follows:
3121
3122           $ sudoedit /etc/motd
3123
3124     The editor will run as the operator user, not root, on a temporary copy
3125     of /etc/motd.  After the file has been edited, /etc/motd will be updated
3126     with the contents of the temporary copy.
3127
3128     Users should never be granted sudoedit permission to edit a file that re‐
3129     sides in a directory the user has write access to, either directly or via
3130     a wildcard.  If the user has write access to the directory it is possible
3131     to replace the legitimate file with a link to another file, allowing the
3132     editing of arbitrary files.  To prevent this, starting with version
3133     1.8.16, symbolic links will not be followed in writable directories and
3134     sudoedit will refuse to edit a file located in a writable directory un‐
3135     less the sudoedit_checkdir option has been disabled or the invoking user
3136     is root.  Additionally, in version 1.8.15 and higher, sudoedit will
3137     refuse to open a symbolic link unless either the sudoedit_follow option
3138     is enabled or the sudoedit command is prefixed with the FOLLOW tag in the
3139     sudoers file.
3140
3141   Time stamp file checks
3142     sudoers will check the ownership of its time stamp directory
3143     (/run/sudo/ts by default) and ignore the directory's contents if it is
3144     not owned by root or if it is writable by a user other than root.  Older
3145     versions of sudo stored time stamp files in /tmp; this is no longer rec‐
3146     ommended as it may be possible for a user to create the time stamp them‐
3147     selves on systems that allow unprivileged users to change the ownership
3148     of files they create.
3149
3150     While the time stamp directory should be cleared at reboot time, not all
3151     systems contain a /run or /var/run directory.  To avoid potential prob‐
3152     lems, sudoers will ignore time stamp files that date from before the ma‐
3153     chine booted on systems where the boot time is available.
3154
3155     Some systems with graphical desktop environments allow unprivileged users
3156     to change the system clock.  Since sudoers relies on the system clock for
3157     time stamp validation, it may be possible on such systems for a user to
3158     run sudo for longer than timestamp_timeout by setting the clock back.  To
3159     combat this, sudoers uses a monotonic clock (which never moves backwards)
3160     for its time stamps if the system supports it.
3161
3162     sudoers will not honor time stamps set far in the future.  Time stamps
3163     with a date greater than current_time + 2 * TIMEOUT will be ignored and
3164     sudoers will log and complain.
3165
3166     If the timestamp_type option is set to “tty”, the time stamp record in‐
3167     cludes the device number of the terminal the user authenticated with.
3168     This provides per-terminal granularity but time stamp records may still
3169     outlive the user's session.
3170
3171     Unless the timestamp_type option is set to “global”, the time stamp
3172     record also includes the session ID of the process that last authenti‐
3173     cated.  This prevents processes in different terminal sessions from using
3174     the same time stamp record.  On systems where a process's start time can
3175     be queried, the start time of the session leader is recorded in the time
3176     stamp record.  If no terminal is present or the timestamp_type option is
3177     set to “ppid”, the start time of the parent process is used instead.  In
3178     most cases this will prevent a time stamp record from being re-used with‐
3179     out the user entering a password when logging out and back in again.
3180

DEBUGGING

3182     Versions 1.8.4 and higher of the sudoers plugin support a flexible debug‐
3183     ging framework that can help track down what the plugin is doing inter‐
3184     nally if there is a problem.  This can be configured in the sudo.conf(5)
3185     file.
3186
3187     The sudoers plugin uses the same debug flag format as the sudo front-end:
3188     subsystem@priority.
3189
3190     The priorities used by sudoers, in order of decreasing severity, are:
3191     crit, err, warn, notice, diag, info, trace and debug.  Each priority,
3192     when specified, also includes all priorities higher than it.  For exam‐
3193     ple, a priority of notice would include debug messages logged at notice
3194     and higher.
3195
3196     The following subsystems are used by the sudoers plugin:
3197
3198     alias     User_Alias, Runas_Alias, Host_Alias and Cmnd_Alias processing
3199
3200     all       matches every subsystem
3201
3202     audit     BSM and Linux audit code
3203
3204     auth      user authentication
3205
3206     defaults  sudoers file Defaults settings
3207
3208     env       environment handling
3209
3210     ldap      LDAP-based sudoers
3211
3212     logging   logging support
3213
3214     match     matching of users, groups, hosts and netgroups in the sudoers
3215               file
3216
3217     netif     network interface handling
3218
3219     nss       network service switch handling in sudoers
3220
3221     parser    sudoers file parsing
3222
3223     perms     permission setting
3224
3225     plugin    The equivalent of main for the plugin.
3226
3227     pty       pseudo-terminal related code
3228
3229     rbtree    redblack tree internals
3230
3231     sssd      SSSD-based sudoers
3232
3233     util      utility functions
3234     For example:
3235
3236     Debug sudo /var/log/sudo_debug match@info,nss@info
3237
3238     For more information, see the sudo.conf(5) manual.
3239

SEE ALSO

3241     ssh(1), su(1), fnmatch(3), glob(3), mktemp(3), strftime(3), sudo.conf(5),
3242     sudo_plugin(5), sudoers.ldap(5), sudoers_timestamp(5), sudo(8), visudo(8)
3243

AUTHORS

3245     Many people have worked on sudo over the years; this version consists of
3246     code written primarily by:
3247
3248           Todd C. Miller
3249
3250     See the CONTRIBUTORS file in the sudo distribution
3251     (https://www.sudo.ws/contributors.html) for an exhaustive list of people
3252     who have contributed to sudo.
3253

CAVEATS

3255     The sudoers file should always be edited by the visudo utility which
3256     locks the file and checks for syntax errors.  If sudoers contains syntax
3257     errors, sudo may refuse to run, which is a serious problem if sudo is
3258     your only method of obtaining superuser privileges.  Recent versions of
3259     sudoers will attempt to recover after a syntax error by ignoring the rest
3260     of the line after encountering an error.  Older versions of sudo will not
3261     run if sudoers contains a syntax error.
3262
3263     When using netgroups of machines (as opposed to users), if you store
3264     fully qualified host name in the netgroup (as is usually the case), you
3265     either need to have the machine's host name be fully qualified as re‐
3266     turned by the hostname command or use the fqdn option in sudoers.
3267

BUGS

3269     If you feel you have found a bug in sudo, please submit a bug report at
3270     https://bugzilla.sudo.ws/
3271

SUPPORT

3273     Limited free support is available via the sudo-users mailing list, see
3274     https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
3275     the archives.
3276

DISCLAIMER

3278     sudo is provided “AS IS” and any express or implied warranties, includ‐
3279     ing, but not limited to, the implied warranties of merchantability and
3280     fitness for a particular purpose are disclaimed.  See the LICENSE file
3281     distributed with sudo or https://www.sudo.ws/license.html for complete
3282     details.
3283
3284Sudo 1.9.7p2                      May 7, 2021                     Sudo 1.9.7p2
Impressum