1SUDOERS(5) BSD File Formats Manual SUDOERS(5)
2
4 sudoers — default sudo security policy plugin
5
7 The sudoers policy plugin determines a user's sudo privileges. It is the
8 default sudo policy plugin. The policy is driven by the /etc/sudoers
9 file or, optionally in LDAP. The policy format is described in detail in
10 the SUDOERS FILE FORMAT section. For information on storing sudoers pol‐
11 icy information in LDAP, please see sudoers.ldap(5).
12
13 Configuring sudo.conf for sudoers
14 sudo consults the sudo.conf(5) file to determine which policy and I/O
15 logging plugins to load. If no sudo.conf(5) file is present, or if it
16 contains no Plugin lines, sudoers will be used for policy decisions and
17 I/O logging. To explicitly configure sudo.conf(5) to use the sudoers
18 plugin, the following configuration can be used.
19
20 Plugin sudoers_policy sudoers.so
21 Plugin sudoers_io sudoers.so
22
23 Starting with sudo 1.8.5, it is possible to specify optional arguments to
24 the sudoers plugin in the sudo.conf(5) file. These arguments, if
25 present, should be listed after the path to the plugin (i.e., after
26 sudoers.so). Multiple arguments may be specified, separated by white
27 space. For example:
28
29 Plugin sudoers_policy sudoers.so sudoers_mode=0400
30
31 The following plugin arguments are supported:
32
33 ldap_conf=pathname
34 The ldap_conf argument can be used to override the default path
35 to the ldap.conf file.
36
37 ldap_secret=pathname
38 The ldap_secret argument can be used to override the default
39 path to the ldap.secret file.
40
41 sudoers_file=pathname
42 The sudoers_file argument can be used to override the default
43 path to the sudoers file.
44
45 sudoers_uid=uid
46 The sudoers_uid argument can be used to override the default
47 owner of the sudoers file. It should be specified as a numeric
48 user-ID.
49
50 sudoers_gid=gid
51 The sudoers_gid argument can be used to override the default
52 group of the sudoers file. It must be specified as a numeric
53 group-ID (not a group name).
54
55 sudoers_mode=mode
56 The sudoers_mode argument can be used to override the default
57 file mode for the sudoers file. It should be specified as an
58 octal value.
59
60 For more information on configuring sudo.conf(5), please refer to its
61 manual.
62
63 User Authentication
64 The sudoers security policy requires that most users authenticate them‐
65 selves before they can use sudo. A password is not required if the
66 invoking user is root, if the target user is the same as the invoking
67 user, or if the policy has disabled authentication for the user or com‐
68 mand. Unlike su(1), when sudoers requires authentication, it validates
69 the invoking user's credentials, not the target user's (or root's) cre‐
70 dentials. This can be changed via the rootpw, targetpw and runaspw
71 flags, described later.
72
73 If a user who is not listed in the policy tries to run a command via
74 sudo, mail is sent to the proper authorities. The address used for such
75 mail is configurable via the mailto Defaults entry (described later) and
76 defaults to root.
77
78 Note that no mail will be sent if an unauthorized user tries to run sudo
79 with the -l or -v option unless there is an authentication error and
80 either the mail_always or mail_badpass flags are enabled. This allows
81 users to determine for themselves whether or not they are allowed to use
82 sudo. By default, all attempts to run sudo (successful or not) are
83 logged, regardless of whether or not mail is sent.
84
85 If sudo is run by root and the SUDO_USER environment variable is set, the
86 sudoers policy will use this value to determine who the actual user is.
87 This can be used by a user to log commands through sudo even when a root
88 shell has been invoked. It also allows the -e option to remain useful
89 even when invoked via a sudo-run script or program. Note, however, that
90 the sudoers file lookup is still done for root, not the user specified by
91 SUDO_USER.
92
93 sudoers uses per-user time stamp files for credential caching. Once a
94 user has been authenticated, a record is written containing the user-ID
95 that was used to authenticate, the terminal session ID, the start time of
96 the session leader (or parent process) and a time stamp (using a mono‐
97 tonic clock if one is available). The user may then use sudo without a
98 password for a short period of time (5 minutes unless overridden by the
99 timestamp_timeout option). By default, sudoers uses a separate record
100 for each terminal, which means that a user's login sessions are authenti‐
101 cated separately. The timestamp_type option can be used to select the
102 type of time stamp record sudoers will use.
103
104 Logging
105 By default, sudoers logs both successful and unsuccessful attempts (as
106 well as errors). The log_allowed and log_denied flags can be used to
107 control this behavior. Messages can be logged to syslog(3), a log file,
108 or both. The default is to log to syslog(3) but this is configurable via
109 the syslog and logfile settings. See LOG FORMAT for a description of the
110 log file format.
111
112 sudoers is also capable of running a command in a pseudo-terminal and
113 logging all input and/or output. The standard input, standard output and
114 standard error can be logged even when not associated with a terminal.
115 I/O logging is not on by default but can be enabled using the log_input
116 and log_output options as well as the LOG_INPUT and LOG_OUTPUT command
117 tags. See I/O LOG FILES for details on how I/O log files are stored.
118
119 Command environment
120 Since environment variables can influence program behavior, sudoers pro‐
121 vides a means to restrict which variables from the user's environment are
122 inherited by the command to be run. There are two distinct ways sudoers
123 can deal with environment variables.
124
125 By default, the env_reset flag is enabled. This causes commands to be
126 executed with a new, minimal environment. On AIX (and Linux systems
127 without PAM), the environment is initialized with the contents of the
128 /etc/environment file. The HOME, MAIL, SHELL, LOGNAME and USER environ‐
129 ment variables are initialized based on the target user and the SUDO_*
130 variables are set based on the invoking user. Additional variables, such
131 as DISPLAY, PATH and TERM, are preserved from the invoking user's envi‐
132 ronment if permitted by the env_check or env_keep options. This is
133 effectively a whitelist for environment variables. A few environment
134 variables are treated specially. If the PATH and TERM variables are not
135 preserved from the user's environment, they will be set to default val‐
136 ues. The LOGNAME and USER are handled as a single entity. If one of
137 them is preserved (or removed) from the user's environment, the other
138 will be as well. If LOGNAME and USER are to be preserved but only one of
139 them is present in the user's environment, the other will be set to the
140 same value. This avoids an inconsistent environment where one of the
141 variables describing the user name is set to the invoking user and one is
142 set to the target user. Environment variables with a value beginning
143 with () are removed unless both the name and value parts are matched by
144 env_keep or env_check, as they may be interpreted as functions by the
145 bash shell. Prior to version 1.8.11, such variables were always removed.
146
147 If, however, the env_reset flag is disabled, any variables not explicitly
148 denied by the env_check and env_delete options are inherited from the
149 invoking process. In this case, env_check and env_delete behave like a
150 blacklist. Prior to version 1.8.21, environment variables with a value
151 beginning with () were always removed. Beginning with version 1.8.21, a
152 pattern in env_delete is used to match bash shell functions instead.
153 Since it is not possible to blacklist all potentially dangerous environ‐
154 ment variables, use of the default env_reset behavior is encouraged.
155
156 Environment variables specified by env_check, env_delete, or env_keep may
157 include one or more ‘*’ characters which will match zero or more charac‐
158 ters. No other wildcard characters are supported.
159
160 By default, environment variables are matched by name. However, if the
161 pattern includes an equal sign (‘=’), both the variables name and value
162 must match. For example, a bash shell function could be matched as fol‐
163 lows:
164
165 env_keep += "BASH_FUNC_my_func%%=()*"
166
167 Without the “=()*” suffix, this would not match, as bash shell functions
168 are not preserved by default.
169
170 The complete list of environment variables that are preserved or removed,
171 as modified by global Defaults parameters in sudoers, is displayed when
172 sudo is run by root with the -V option. Please note that the list of
173 environment variables to remove varies based on the operating system sudo
174 is running on.
175
176 Other sudoers options may influence the command environment, such as
177 always_set_home, secure_path, set_logname, and set_home.
178
179 On systems that support PAM where the pam_env module is enabled for sudo,
180 variables in the PAM environment may be merged in to the environment. If
181 a variable in the PAM environment is already present in the user's envi‐
182 ronment, the value will only be overridden if the variable was not pre‐
183 served by sudoers. When env_reset is enabled, variables preserved from
184 the invoking user's environment by the env_keep list take precedence over
185 those in the PAM environment. When env_reset is disabled, variables
186 present the invoking user's environment take precedence over those in the
187 PAM environment unless they match a pattern in the env_delete list.
188
189 Note that the dynamic linker on most operating systems will remove vari‐
190 ables that can control dynamic linking from the environment of set-user-
191 ID executables, including sudo. Depending on the operating system this
192 may include _RLD*, DYLD_*, LD_*, LDR_*, LIBPATH, SHLIB_PATH, and others.
193 These type of variables are removed from the environment before sudo even
194 begins execution and, as such, it is not possible for sudo to preserve
195 them.
196
197 As a special case, if the -i option (initial login) is specified, sudoers
198 will initialize the environment regardless of the value of env_reset.
199 The DISPLAY, PATH and TERM variables remain unchanged; HOME, MAIL, SHELL,
200 USER, and LOGNAME are set based on the target user. On AIX (and Linux
201 systems without PAM), the contents of /etc/environment are also included.
202 All other environment variables are removed unless permitted by env_keep
203 or env_check, described above.
204
205 Finally, the restricted_env_file and env_file files are applied, if
206 present. The variables in restricted_env_file are applied first and are
207 subject to the same restrictions as the invoking user's environment, as
208 detailed above. The variables in env_file are applied last and are not
209 subject to these restrictions. In both cases, variables present in the
210 files will only be set to their specified values if they would not con‐
211 flict with an existing environment variable.
212
214 The sudoers file is composed of two types of entries: aliases (basically
215 variables) and user specifications (which specify who may run what).
216
217 When multiple entries match for a user, they are applied in order. Where
218 there are multiple matches, the last match is used (which is not neces‐
219 sarily the most specific match).
220
221 The sudoers file grammar will be described below in Extended Backus-Naur
222 Form (EBNF). Don't despair if you are unfamiliar with EBNF; it is fairly
223 simple, and the definitions below are annotated.
224
225 Quick guide to EBNF
226 EBNF is a concise and exact way of describing the grammar of a language.
227 Each EBNF definition is made up of production rules. E.g.,
228
229 symbol ::= definition | alternate1 | alternate2 ...
230
231 Each production rule references others and thus makes up a grammar for
232 the language. EBNF also contains the following operators, which many
233 readers will recognize from regular expressions. Do not, however, con‐
234 fuse them with “wildcard” characters, which have different meanings.
235
236 ? Means that the preceding symbol (or group of symbols) is optional.
237 That is, it may appear once or not at all.
238
239 * Means that the preceding symbol (or group of symbols) may appear
240 zero or more times.
241
242 + Means that the preceding symbol (or group of symbols) may appear
243 one or more times.
244
245 Parentheses may be used to group symbols together. For clarity, we will
246 use single quotes ('') to designate what is a verbatim character string
247 (as opposed to a symbol name).
248
249 Aliases
250 There are four kinds of aliases: User_Alias, Runas_Alias, Host_Alias and
251 Cmnd_Alias. Beginning with sudo 1.9.0, Cmd_Alias may be used in place of
252 Cmnd_Alias if desired.
253
254 Alias ::= 'User_Alias' User_Alias_Spec (':' User_Alias_Spec)* |
255 'Runas_Alias' Runas_Alias_Spec (':' Runas_Alias_Spec)* |
256 'Host_Alias' Host_Alias_Spec (':' Host_Alias_Spec)* |
257 'Cmnd_Alias' Cmnd_Alias_Spec (':' Cmnd_Alias_Spec)* |
258 'Cmd_Alias' Cmnd_Alias_Spec (':' Cmnd_Alias_Spec)*
259
260 User_Alias ::= NAME
261
262 User_Alias_Spec ::= User_Alias '=' User_List
263
264 Runas_Alias ::= NAME
265
266 Runas_Alias_Spec ::= Runas_Alias '=' Runas_List
267
268 Host_Alias ::= NAME
269
270 Host_Alias_Spec ::= Host_Alias '=' Host_List
271
272 Cmnd_Alias ::= NAME
273
274 Cmnd_Alias_Spec ::= Cmnd_Alias '=' Cmnd_List
275
276 NAME ::= [A-Z]([A-Z][0-9]_)*
277
278 Each alias definition is of the form
279
280 Alias_Type NAME = item1, item2, ...
281
282 where Alias_Type is one of User_Alias, Runas_Alias, Host_Alias, or
283 Cmnd_Alias. A NAME is a string of uppercase letters, numbers, and under‐
284 score characters (‘_’). A NAME must start with an uppercase letter. It
285 is possible to put several alias definitions of the same type on a single
286 line, joined by a colon (‘:’). E.g.,
287
288 Alias_Type NAME = item1, item2, item3 : NAME = item4, item5
289
290 It is a syntax error to redefine an existing alias. It is possible to
291 use the same name for aliases of different types, but this is not recom‐
292 mended.
293
294 The definitions of what constitutes a valid alias member follow.
295
296 User_List ::= User |
297 User ',' User_List
298
299 User ::= '!'* user name |
300 '!'* #uid |
301 '!'* %group |
302 '!'* %#gid |
303 '!'* +netgroup |
304 '!'* %:nonunix_group |
305 '!'* %:#nonunix_gid |
306 '!'* User_Alias
307
308 A User_List is made up of one or more user names, user-IDs (prefixed with
309 ‘#’), system group names and IDs (prefixed with ‘%’ and ‘%#’ respec‐
310 tively), netgroups (prefixed with ‘+’), non-Unix group names and IDs
311 (prefixed with ‘%:’ and ‘%:#’ respectively) and User_Aliases. Each list
312 item may be prefixed with zero or more ‘!’ operators. An odd number of
313 ‘!’ operators negate the value of the item; an even number just cancel
314 each other out. User netgroups are matched using the user and domain
315 members only; the host member is not used when matching.
316
317 A user name, uid, group, gid, netgroup, nonunix_group or nonunix_gid may
318 be enclosed in double quotes to avoid the need for escaping special char‐
319 acters. Alternately, special characters may be specified in escaped hex
320 mode, e.g., \x20 for space. When using double quotes, any prefix charac‐
321 ters must be included inside the quotes.
322
323 The actual nonunix_group and nonunix_gid syntax depends on the underlying
324 group provider plugin. For instance, the QAS AD plugin supports the fol‐
325 lowing formats:
326
327 · Group in the same domain: "%:Group Name"
328
329 · Group in any domain: "%:Group Name@FULLY.QUALIFIED.DOMAIN"
330
331 · Group SID: "%:S-1-2-34-5678901234-5678901234-5678901234-567"
332
333 See GROUP PROVIDER PLUGINS for more information.
334
335 Note that quotes around group names are optional. Unquoted strings must
336 use a backslash (‘\’) to escape spaces and special characters. See Other
337 special characters and reserved words for a list of characters that need
338 to be escaped.
339
340 Runas_List ::= Runas_Member |
341 Runas_Member ',' Runas_List
342
343 Runas_Member ::= '!'* user name |
344 '!'* #uid |
345 '!'* %group |
346 '!'* %#gid |
347 '!'* %:nonunix_group |
348 '!'* %:#nonunix_gid |
349 '!'* +netgroup |
350 '!'* Runas_Alias
351
352 A Runas_List is similar to a User_List except that instead of
353 User_Aliases it can contain Runas_Aliases. Note that user names and
354 groups are matched as strings. In other words, two users (groups) with
355 the same user (group) ID are considered to be distinct. If you wish to
356 match all user names with the same user-ID (e.g., root and toor), you can
357 use a user-ID instead of a name (#0 in the example given). Note that the
358 user-ID or group-ID specified in a Runas_Member need not be listed in the
359 password or group database.
360
361 Host_List ::= Host |
362 Host ',' Host_List
363
364 Host ::= '!'* host name |
365 '!'* ip_addr |
366 '!'* network(/netmask)? |
367 '!'* +netgroup |
368 '!'* Host_Alias
369
370 A Host_List is made up of one or more host names, IP addresses, network
371 numbers, netgroups (prefixed with ‘+’) and other aliases. Again, the
372 value of an item may be negated with the ‘!’ operator. Host netgroups
373 are matched using the host (both qualified and unqualified) and domain
374 members only; the user member is not used when matching. If you specify
375 a network number without a netmask, sudo will query each of the local
376 host's network interfaces and, if the network number corresponds to one
377 of the hosts's network interfaces, will use the netmask of that inter‐
378 face. The netmask may be specified either in standard IP address nota‐
379 tion (e.g., 255.255.255.0 or ffff:ffff:ffff:ffff::), or CIDR notation
380 (number of bits, e.g., 24 or 64). A host name may include shell-style
381 wildcards (see the Wildcards section below), but unless the host name
382 command on your machine returns the fully qualified host name, you'll
383 need to use the fqdn flag for wildcards to be useful. Note that sudo
384 only inspects actual network interfaces; this means that IP address
385 127.0.0.1 (localhost) will never match. Also, the host name “localhost”
386 will only match if that is the actual host name, which is usually only
387 the case for non-networked systems.
388
389 digest ::= [A-Fa-f0-9]+ |
390 [A-Za-z0-9\+/=]+
391
392 Digest_Spec ::= "sha224" ':' digest |
393 "sha256" ':' digest |
394 "sha384" ':' digest |
395 "sha512" ':' digest
396
397 Digest_List ::= Digest_Spec |
398 Digest_Spec ',' Digest_List
399
400 Cmnd_List ::= Cmnd |
401 Cmnd ',' Cmnd_List
402
403 command name ::= file name |
404 file name args |
405 file name '""'
406
407 Cmnd ::= Digest_List? '!'* command name |
408 '!'* directory |
409 '!'* "sudoedit" |
410 '!'* Cmnd_Alias
411
412 A Cmnd_List is a list of one or more command names, directories, and
413 other aliases. A command name is a fully qualified file name which may
414 include shell-style wildcards (see the Wildcards section below). A sim‐
415 ple file name allows the user to run the command with any arguments they
416 wish. However, you may also specify command line arguments (including
417 wildcards). Alternately, you can specify "" to indicate that the command
418 may only be run without command line arguments. A directory is a fully
419 qualified path name ending in a ‘/’. When you specify a directory in a
420 Cmnd_List, the user will be able to run any file within that directory
421 (but not in any sub-directories therein).
422
423 If a Cmnd has associated command line arguments, then the arguments in
424 the Cmnd must match exactly those given by the user on the command line
425 (or match the wildcards if there are any). Note that the following char‐
426 acters must be escaped with a ‘\’ if they are used in command arguments:
427 ‘,’, ‘:’, ‘=’, ‘\’. The built-in command “sudoedit” is used to permit a
428 user to run sudo with the -e option (or as sudoedit). It may take com‐
429 mand line arguments just as a normal command does. Note that “sudoedit”
430 is a command built into sudo itself and must be specified in the sudoers
431 file without a leading path. If a leading path is present, for example
432 /usr/bin/sudoedit, the path name will be silently converted to
433 “sudoedit”. A fully-qualified path for sudoedit is treated as an error
434 by visudo.
435
436 A command name may be preceded by a Digest_List, a comma-separated list
437 of one or more Digest_Spec entries. If a Digest_List is present, the
438 command will only match successfully if it can be verified using one of
439 the SHA-2 digests in the list. Starting with version 1.9.0, the ALL
440 reserved word can be used in conjunction with a Digest_List. The follow‐
441 ing digest formats are supported: sha224, sha256, sha384 and sha512. The
442 string may be specified in either hex or base64 format (base64 is more
443 compact). There are several utilities capable of generating SHA-2
444 digests in hex format such as openssl, shasum, sha224sum, sha256sum,
445 sha384sum, sha512sum.
446
447 For example, using openssl:
448
449 $ openssl dgst -sha224 /bin/ls
450 SHA224(/bin/ls)= 118187da8364d490b4a7debbf483004e8f3e053ec954309de2c41a25
451
452 It is also possible to use openssl to generate base64 output:
453
454 $ openssl dgst -binary -sha224 /bin/ls | openssl base64
455 EYGH2oNk1JC0p9679IMATo8+BT7JVDCd4sQaJQ==
456
457 Warning, if the user has write access to the command itself (directly or
458 via a sudo command), it may be possible for the user to replace the com‐
459 mand after the digest check has been performed but before the command is
460 executed. A similar race condition exists on systems that lack the
461 fexecve(2) system call when the directory in which the command is located
462 is writable by the user. See the description of the fdexec setting for
463 more information on how sudo executes commands that have an associated
464 digest.
465
466 Command digests are only supported by version 1.8.7 or higher.
467
468 Defaults
469 Certain configuration options may be changed from their default values at
470 run-time via one or more Default_Entry lines. These may affect all users
471 on any host, all users on a specific host, a specific user, a specific
472 command, or commands being run as a specific user. Note that per-command
473 entries may not include command line arguments. If you need to specify
474 arguments, define a Cmnd_Alias and reference that instead.
475
476 Default_Type ::= 'Defaults' |
477 'Defaults' '@' Host_List |
478 'Defaults' ':' User_List |
479 'Defaults' '!' Cmnd_List |
480 'Defaults' '>' Runas_List
481
482 Default_Entry ::= Default_Type Parameter_List
483
484 Parameter_List ::= Parameter |
485 Parameter ',' Parameter_List
486
487 Parameter ::= Parameter '=' Value |
488 Parameter '+=' Value |
489 Parameter '-=' Value |
490 '!'* Parameter
491
492 Parameters may be flags, integer values, strings, or lists. Flags are
493 implicitly boolean and can be turned off via the ‘!’ operator. Some
494 integer, string and list parameters may also be used in a boolean context
495 to disable them. Values may be enclosed in double quotes ("") when they
496 contain multiple words. Special characters may be escaped with a back‐
497 slash (‘\’).
498
499 Lists have two additional assignment operators, += and -=. These opera‐
500 tors are used to add to and delete from a list respectively. It is not
501 an error to use the -= operator to remove an element that does not exist
502 in a list.
503
504 Defaults entries are parsed in the following order: generic, host, user
505 and runas Defaults first, then command defaults. If there are multiple
506 Defaults settings of the same type, the last matching setting is used.
507 The following Defaults settings are parsed before all others since they
508 may affect subsequent entries: fqdn, group_plugin, runas_default,
509 sudoers_locale.
510
511 See SUDOERS OPTIONS for a list of supported Defaults parameters.
512
513 User specification
514 User_Spec ::= User_List Host_List '=' Cmnd_Spec_List \
515 (':' Host_List '=' Cmnd_Spec_List)*
516
517 Cmnd_Spec_List ::= Cmnd_Spec |
518 Cmnd_Spec ',' Cmnd_Spec_List
519
520 Cmnd_Spec ::= Runas_Spec? Option_Spec* Tag_Spec* Cmnd
521
522 Runas_Spec ::= '(' Runas_List? (':' Runas_List)? ')'
523
524 Option_Spec ::= (SELinux_Spec | Date_Spec | Timeout_Spec)
525
526 SELinux_Spec ::= ('ROLE=role' | 'TYPE=type')
527
528 Date_Spec ::= ('NOTBEFORE=timestamp' | 'NOTAFTER=timestamp')
529
530 Timeout_Spec ::= 'TIMEOUT=timeout'
531
532 Tag_Spec ::= ('EXEC:' | 'NOEXEC:' | 'FOLLOW:' | 'NOFOLLOW' |
533 'LOG_INPUT:' | 'NOLOG_INPUT:' | 'LOG_OUTPUT:' |
534 'NOLOG_OUTPUT:' | 'MAIL:' | 'NOMAIL:' | 'PASSWD:' |
535 'NOPASSWD:' | 'SETENV:' | 'NOSETENV:')
536
537 A user specification determines which commands a user may run (and as
538 what user) on specified hosts. By default, commands are run as root, but
539 this can be changed on a per-command basis.
540
541 The basic structure of a user specification is “who where = (as_whom)
542 what”. Let's break that down into its constituent parts:
543
544 Runas_Spec
545 A Runas_Spec determines the user and/or the group that a command may be
546 run as. A fully-specified Runas_Spec consists of two Runas_Lists (as
547 defined above) separated by a colon (‘:’) and enclosed in a set of paren‐
548 theses. The first Runas_List indicates which users the command may be
549 run as via the -u option. The second defines a list of groups that can
550 be specified via the -g option in addition to any of the target user's
551 groups. If both Runas_Lists are specified, the command may be run with
552 any combination of users and groups listed in their respective
553 Runas_Lists. If only the first is specified, the command may be run as
554 any user in the list but no -g option may be specified. If the first
555 Runas_List is empty but the second is specified, the command may be run
556 as the invoking user with the group set to any listed in the Runas_List.
557 If both Runas_Lists are empty, the command may only be run as the invok‐
558 ing user. If no Runas_Spec is specified the command may be run as root
559 and no group may be specified.
560
561 A Runas_Spec sets the default for the commands that follow it. What this
562 means is that for the entry:
563
564 dgb boulder = (operator) /bin/ls, /bin/kill, /usr/bin/lprm
565
566 The user dgb may run /bin/ls, /bin/kill, and /usr/bin/lprm on the host
567 boulder—but only as operator. E.g.,
568
569 $ sudo -u operator /bin/ls
570
571 It is also possible to override a Runas_Spec later on in an entry. If we
572 modify the entry like so:
573
574 dgb boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm
575
576 Then user dgb is now allowed to run /bin/ls as operator, but /bin/kill
577 and /usr/bin/lprm as root.
578
579 We can extend this to allow dgb to run /bin/ls with either the user or
580 group set to operator:
581
582 dgb boulder = (operator : operator) /bin/ls, (root) /bin/kill,\
583 /usr/bin/lprm
584
585 Note that while the group portion of the Runas_Spec permits the user to
586 run as command with that group, it does not force the user to do so. If
587 no group is specified on the command line, the command will run with the
588 group listed in the target user's password database entry. The following
589 would all be permitted by the sudoers entry above:
590
591 $ sudo -u operator /bin/ls
592 $ sudo -u operator -g operator /bin/ls
593 $ sudo -g operator /bin/ls
594
595 In the following example, user tcm may run commands that access a modem
596 device file with the dialer group.
597
598 tcm boulder = (:dialer) /usr/bin/tip, /usr/bin/cu,\
599 /usr/local/bin/minicom
600
601 Note that in this example only the group will be set, the command still
602 runs as user tcm. E.g.
603
604 $ sudo -g dialer /usr/bin/cu
605
606 Multiple users and groups may be present in a Runas_Spec, in which case
607 the user may select any combination of users and groups via the -u and -g
608 options. In this example:
609
610 alan ALL = (root, bin : operator, system) ALL
611
612 user alan may run any command as either user root or bin, optionally set‐
613 ting the group to operator or system.
614
615 Option_Spec
616 A Cmnd may have zero or more options associated with it. Options may
617 consist of SELinux roles and/or types, start and/or end dates and command
618 timeouts. Once an option is set for a Cmnd, subsequent Cmnds in the
619 Cmnd_Spec_List, inherit that option unless it is overridden by another
620 option.
621
622 SELinux_Spec
623 On systems with SELinux support, sudoers file entries may optionally have
624 an SELinux role and/or type associated with a command. If a role or type
625 is specified with the command it will override any default values speci‐
626 fied in sudoers. A role or type specified on the command line, however,
627 will supersede the values in sudoers.
628
629 Date_Spec
630 sudoers rules can be specified with a start and end date via the
631 NOTBEFORE and NOTAFTER settings. The time stamp must be specified in
632 Generalized Time as defined by RFC 4517. The format is effectively
633 yyyymmddHHMMSSZ where the minutes and seconds are optional. The ‘Z’ suf‐
634 fix indicates that the time stamp is in Coordinated Universal Time (UTC).
635 It is also possible to specify a timezone offset from UTC in hours and
636 minutes instead of a ‘Z’. For example, ‘-0500’ would correspond to East‐
637 ern Standard time in the US. As an extension, if no ‘Z’ or timezone off‐
638 set is specified, local time will be used.
639
640 The following are all valid time stamps:
641
642 20170214083000Z
643 2017021408Z
644 20160315220000-0500
645 20151201235900
646
647 Timeout_Spec
648 A command may have a timeout associated with it. If the timeout expires
649 before the command has exited, the command will be terminated. The time‐
650 out may be specified in combinations of days, hours, minutes and seconds
651 with a single-letter case-insensitive suffix that indicates the unit of
652 time. For example, a timeout of 7 days, 8 hours, 30 minutes and 10 sec‐
653 onds would be written as 7d8h30m10s. If a number is specified without a
654 unit, seconds are assumed. Any of the days, minutes, hours or seconds
655 may be omitted. The order must be from largest to smallest unit and a
656 unit may not be specified more than once.
657
658 The following are all valid timeout values: 7d8h30m10s, 14d, 8h30m, 600s,
659 3600. The following are invalid timeout values: 12m2w1d, 30s10m4h,
660 1d2d3h.
661
662 This setting is only supported by version 1.8.20 or higher.
663
664 Tag_Spec
665 A command may have zero or more tags associated with it. The following
666 tag values are supported: EXEC, NOEXEC, FOLLOW, NOFOLLOW, LOG_INPUT,
667 NOLOG_INPUT, LOG_OUTPUT, NOLOG_OUTPUT, MAIL, NOMAIL, PASSWD, NOPASSWD,
668 SETENV, and NOSETENV. Once a tag is set on a Cmnd, subsequent Cmnds in
669 the Cmnd_Spec_List, inherit the tag unless it is overridden by the oppo‐
670 site tag (in other words, PASSWD overrides NOPASSWD and NOEXEC overrides
671 EXEC).
672
673 EXEC and NOEXEC
674
675 If sudo has been compiled with noexec support and the underlying oper‐
676 ating system supports it, the NOEXEC tag can be used to prevent a
677 dynamically-linked executable from running further commands itself.
678
679 In the following example, user aaron may run /usr/bin/more and
680 /usr/bin/vi but shell escapes will be disabled.
681
682 aaron shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
683
684 See the Preventing shell escapes section below for more details on how
685 NOEXEC works and whether or not it will work on your system.
686
687 FOLLOW and NOFOLLOW Starting with version 1.8.15, sudoedit will not open
688 a file that is a symbolic link unless the sudoedit_follow flag is
689 enabled. The FOLLOW and NOFOLLOW tags override the value of
690 sudoedit_follow and can be used to permit (or deny) the editing of sym‐
691 bolic links on a per-command basis. These tags are only effective for
692 the sudoedit command and are ignored for all other commands.
693
694 LOG_INPUT and NOLOG_INPUT
695
696 These tags override the value of the log_input flag on a per-command
697 basis. For more information, see the description of log_input in the
698 SUDOERS OPTIONS section below.
699
700 LOG_OUTPUT and NOLOG_OUTPUT
701
702 These tags override the value of the log_output flag on a per-command
703 basis. For more information, see the description of log_output in the
704 SUDOERS OPTIONS section below.
705
706 MAIL and NOMAIL
707
708 These tags provide fine-grained control over whether mail will be sent
709 when a user runs a command by overriding the value of the
710 mail_all_cmnds flag on a per-command basis. They have no effect when
711 sudo is run with the -l or -v options. A NOMAIL tag will also override
712 the mail_always and mail_no_perms options. For more information, see
713 the descriptions of mail_all_cmnds, mail_always, and mail_no_perms in
714 the SUDOERS OPTIONS section below.
715
716 PASSWD and NOPASSWD
717
718 By default, sudo requires that a user authenticate him or herself
719 before running a command. This behavior can be modified via the
720 NOPASSWD tag. Like a Runas_Spec, the NOPASSWD tag sets a default for
721 the commands that follow it in the Cmnd_Spec_List. Conversely, the
722 PASSWD tag can be used to reverse things. For example:
723
724 ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
725
726 would allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm
727 as root on the machine rushmore without authenticating himself. If we
728 only want ray to be able to run /bin/kill without a password the entry
729 would be:
730
731 ray rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
732
733 Note, however, that the PASSWD tag has no effect on users who are in
734 the group specified by the exempt_group setting.
735
736 By default, if the NOPASSWD tag is applied to any of a user's entries
737 for the current host, the user will be able to run “sudo -l” without a
738 password. Additionally, a user may only run “sudo -v” without a pass‐
739 word if all of the user's entries for the current host have the
740 NOPASSWD tag. This behavior may be overridden via the verifypw and
741 listpw options.
742
743 SETENV and NOSETENV
744
745 These tags override the value of the setenv flag on a per-command
746 basis. Note that if SETENV has been set for a command, the user may
747 disable the env_reset flag from the command line via the -E option.
748 Additionally, environment variables set on the command line are not
749 subject to the restrictions imposed by env_check, env_delete, or
750 env_keep. As such, only trusted users should be allowed to set vari‐
751 ables in this manner. If the command matched is ALL, the SETENV tag is
752 implied for that command; this default may be overridden by use of the
753 NOSETENV tag.
754
755 Wildcards
756 sudo allows shell-style wildcards (aka meta or glob characters) to be
757 used in host names, path names and command line arguments in the sudoers
758 file. Wildcard matching is done via the glob(3) and fnmatch(3) functions
759 as specified by IEEE Std 1003.1 (“POSIX.1”).
760
761 * Matches any set of zero or more characters (including white
762 space).
763
764 ? Matches any single character (including white space).
765
766 [...] Matches any character in the specified range.
767
768 [!...] Matches any character not in the specified range.
769
770 \x For any character ‘x’, evaluates to ‘x’. This is used to
771 escape special characters such as: ‘*’, ‘?’, ‘[’, and ‘]’.
772
773 Note that these are not regular expressions. Unlike a regular expression
774 there is no way to match one or more characters within a range.
775
776 Character classes may be used if your system's glob(3) and fnmatch(3)
777 functions support them. However, because the ‘:’ character has special
778 meaning in sudoers, it must be escaped. For example:
779
780 /bin/ls [[\:alpha\:]]*
781
782 Would match any file name beginning with a letter.
783
784 Note that a forward slash (‘/’) will not be matched by wildcards used in
785 the file name portion of the command. This is to make a path like:
786
787 /usr/bin/*
788
789 match /usr/bin/who but not /usr/bin/X11/xterm.
790
791 When matching the command line arguments, however, a slash does get
792 matched by wildcards since command line arguments may contain arbitrary
793 strings and not just path names.
794
795 Wildcards in command line arguments should be used with care.
796 Command line arguments are matched as a single, concatenated string.
797 This mean a wildcard character such as ‘?’ or ‘*’ will match across word
798 boundaries, which may be unexpected. For example, while a sudoers entry
799 like:
800
801 %operator ALL = /bin/cat /var/log/messages*
802
803 will allow command like:
804
805 $ sudo cat /var/log/messages.1
806
807 It will also allow:
808
809 $ sudo cat /var/log/messages /etc/shadow
810
811 which is probably not what was intended. In most cases it is better to
812 do command line processing outside of the sudoers file in a scripting
813 language.
814
815 Exceptions to wildcard rules
816 The following exceptions apply to the above rules:
817
818 "" If the empty string "" is the only command line argument in the
819 sudoers file entry it means that command is not allowed to be
820 run with any arguments.
821
822 sudoedit Command line arguments to the sudoedit built-in command should
823 always be path names, so a forward slash (‘/’) will not be
824 matched by a wildcard.
825
826 Including other files from within sudoers
827 It is possible to include other sudoers files from within the sudoers
828 file currently being parsed using the #include and #includedir direc‐
829 tives.
830
831 This can be used, for example, to keep a site-wide sudoers file in addi‐
832 tion to a local, per-machine file. For the sake of this example the
833 site-wide sudoers file will be /etc/sudoers and the per-machine one will
834 be /etc/sudoers.local. To include /etc/sudoers.local from within
835 /etc/sudoers we would use the following line in /etc/sudoers:
836
837 #include /etc/sudoers.local
838
839 When sudo reaches this line it will suspend processing of the current
840 file (/etc/sudoers) and switch to /etc/sudoers.local. Upon reaching the
841 end of /etc/sudoers.local, the rest of /etc/sudoers will be processed.
842 Files that are included may themselves include other files. A hard limit
843 of 128 nested include files is enforced to prevent include file loops.
844
845 If the path to the include file is not fully-qualified (does not begin
846 with a ‘/’), it must be located in the same directory as the sudoers file
847 it was included from. For example, if /etc/sudoers contains the line:
848
849 #include sudoers.local
850
851 the file that will be included is /etc/sudoers.local.
852
853 The file name may also include the %h escape, signifying the short form
854 of the host name. In other words, if the machine's host name is
855 “xerxes”, then
856
857 #include /etc/sudoers.%h
858
859 will cause sudo to include the file /etc/sudoers.xerxes.
860
861 The #includedir directive can be used to create a sudoers.d directory
862 that the system package manager can drop sudoers file rules into as part
863 of package installation. For example, given:
864
865 #includedir /etc/sudoers.d
866
867 sudo will suspend processing of the current file and read each file in
868 /etc/sudoers.d, skipping file names that end in ‘~’ or contain a ‘.’
869 character to avoid causing problems with package manager or editor tempo‐
870 rary/backup files. Files are parsed in sorted lexical order. That is,
871 /etc/sudoers.d/01_first will be parsed before /etc/sudoers.d/10_second.
872 Be aware that because the sorting is lexical, not numeric,
873 /etc/sudoers.d/1_whoops would be loaded after /etc/sudoers.d/10_second.
874 Using a consistent number of leading zeroes in the file names can be used
875 to avoid such problems. After parsing the files in the directory, con‐
876 trol returns to the file that contained the #includedir directive.
877
878 Note that unlike files included via #include, visudo will not edit the
879 files in a #includedir directory unless one of them contains a syntax
880 error. It is still possible to run visudo with the -f flag to edit the
881 files directly, but this will not catch the redefinition of an alias that
882 is also present in a different file.
883
884 Other special characters and reserved words
885 The pound sign (‘#’) is used to indicate a comment (unless it is part of
886 a #include directive or unless it occurs in the context of a user name
887 and is followed by one or more digits, in which case it is treated as a
888 user-ID). Both the comment character and any text after it, up to the
889 end of the line, are ignored.
890
891 The reserved word ALL is a built-in alias that always causes a match to
892 succeed. It can be used wherever one might otherwise use a Cmnd_Alias,
893 User_Alias, Runas_Alias, or Host_Alias. You should not try to define
894 your own alias called ALL as the built-in alias will be used in prefer‐
895 ence to your own. Please note that using ALL can be dangerous since in a
896 command context, it allows the user to run any command on the system.
897
898 An exclamation point (‘!’) can be used as a logical not operator in a
899 list or alias as well as in front of a Cmnd. This allows one to exclude
900 certain values. For the ‘!’ operator to be effective, there must be
901 something for it to exclude. For example, to match all users except for
902 root one would use:
903
904 ALL,!root
905
906 If the ALL, is omitted, as in:
907
908 !root
909
910 it would explicitly deny root but not match any other users. This is
911 different from a true “negation” operator.
912
913 Note, however, that using a ‘!’ in conjunction with the built-in ALL
914 alias to allow a user to run “all but a few” commands rarely works as
915 intended (see SECURITY NOTES below).
916
917 Long lines can be continued with a backslash (‘\’) as the last character
918 on the line.
919
920 White space between elements in a list as well as special syntactic char‐
921 acters in a User Specification (‘=’, ‘:’, ‘(’, ‘)’) is optional.
922
923 The following characters must be escaped with a backslash (‘\’) when used
924 as part of a word (e.g., a user name or host name): ‘!’, ‘=’, ‘:’, ‘,’,
925 ‘(’, ‘)’, ‘\’.
926
928 sudo's behavior can be modified by Default_Entry lines, as explained ear‐
929 lier. A list of all supported Defaults parameters, grouped by type, are
930 listed below.
931
932 Boolean Flags:
933
934 always_query_group_plugin
935 If a group_plugin is configured, use it to resolve
936 groups of the form %group as long as there is not also
937 a system group of the same name. Normally, only groups
938 of the form %:group are passed to the group_plugin.
939 This flag is off by default.
940
941 always_set_home If enabled, sudo will set the HOME environment variable
942 to the home directory of the target user (which is the
943 root user unless the -u option is used). This flag is
944 largely obsolete and has no effect unless the env_reset
945 flag has been disabled or HOME is present in the
946 env_keep list, both of which are strongly discouraged.
947 This flag is off by default.
948
949 authenticate If set, users must authenticate themselves via a pass‐
950 word (or other means of authentication) before they may
951 run commands. This default may be overridden via the
952 PASSWD and NOPASSWD tags. This flag is on by default.
953
954 case_insensitive_group
955 If enabled, group names in sudoers will be matched in a
956 case insensitive manner. This may be necessary when
957 users are stored in LDAP or AD. This flag is on by
958 default.
959
960 case_insensitive_user
961 If enabled, user names in sudoers will be matched in a
962 case insensitive manner. This may be necessary when
963 groups are stored in LDAP or AD. This flag is on by
964 default.
965
966 closefrom_override
967 If set, the user may use the -C option which overrides
968 the default starting point at which sudo begins closing
969 open file descriptors. This flag is off by default.
970
971 compress_io If set, and sudo is configured to log a command's input
972 or output, the I/O logs will be compressed using zlib.
973 This flag is on by default when sudo is compiled with
974 zlib support.
975
976 exec_background By default, sudo runs a command as the foreground
977 process as long as sudo itself is running in the fore‐
978 ground. When the exec_background flag is enabled and
979 the command is being run in a pseudo-terminal (due to
980 I/O logging or the use_pty flag), the command will be
981 run as a background process. Attempts to read from the
982 controlling terminal (or to change terminal settings)
983 will result in the command being suspended with the
984 SIGTTIN signal (or SIGTTOU in the case of terminal set‐
985 tings). If this happens when sudo is a foreground
986 process, the command will be granted the controlling
987 terminal and resumed in the foreground with no user
988 intervention required. The advantage of initially run‐
989 ning the command in the background is that sudo need
990 not read from the terminal unless the command explic‐
991 itly requests it. Otherwise, any terminal input must
992 be passed to the command, whether it has required it or
993 not (the kernel buffers terminals so it is not possible
994 to tell whether the command really wants the input).
995 This is different from historic sudo behavior or when
996 the command is not being run in a pseudo-terminal.
997
998 For this to work seamlessly, the operating system must
999 support the automatic restarting of system calls.
1000 Unfortunately, not all operating systems do this by
1001 default, and even those that do may have bugs. For
1002 example, macOS fails to restart the tcgetattr() and
1003 tcsetattr() system calls (this is a bug in macOS).
1004 Furthermore, because this behavior depends on the com‐
1005 mand stopping with the SIGTTIN or SIGTTOU signals, pro‐
1006 grams that catch these signals and suspend themselves
1007 with a different signal (usually SIGTOP) will not be
1008 automatically foregrounded. Some versions of the linux
1009 su(1) command behave this way. This flag is off by
1010 default.
1011
1012 This setting is only supported by version 1.8.7 or
1013 higher. It has no effect unless I/O logging is enabled
1014 or the use_pty flag is enabled.
1015
1016 env_editor If set, visudo will use the value of the SUDO_EDITOR,
1017 VISUAL or EDITOR environment variables before falling
1018 back on the default editor list. Note that visudo is
1019 typically run as root so this flag may allow a user
1020 with visudo privileges to run arbitrary commands as
1021 root without logging. An alternative is to place a
1022 colon-separated list of “safe” editors int the editor
1023 variable. visudo will then only use SUDO_EDITOR,
1024 VISUAL or EDITOR if they match a value specified in
1025 editor. If the env_reset flag is enabled, the
1026 SUDO_EDITOR, VISUAL and/or EDITOR environment variables
1027 must be present in the env_keep list for the env_editor
1028 flag to function when visudo is invoked via sudo. This
1029 flag is on by default.
1030
1031 env_reset If set, sudo will run the command in a minimal environ‐
1032 ment containing the TERM, PATH, HOME, MAIL, SHELL,
1033 LOGNAME, USER and SUDO_* variables. Any variables in
1034 the caller's environment or in the file specified by
1035 the restricted_env_file setting that match the env_keep
1036 and env_check lists are then added, followed by any
1037 variables present in the file specified by the env_file
1038 setting (if any). The contents of the env_keep and
1039 env_check lists, as modified by global Defaults parame‐
1040 ters in sudoers, are displayed when sudo is run by root
1041 with the -V option. If the secure_path setting is
1042 enabled, its value will be used for the PATH environ‐
1043 ment variable. This flag is on by default.
1044
1045 fast_glob Normally, sudo uses the glob(3) function to do shell-
1046 style globbing when matching path names. However,
1047 since it accesses the file system, glob(3) can take a
1048 long time to complete for some patterns, especially
1049 when the pattern references a network file system that
1050 is mounted on demand (auto mounted). The fast_glob
1051 flag causes sudo to use the fnmatch(3) function, which
1052 does not access the file system to do its matching.
1053 The disadvantage of fast_glob is that it is unable to
1054 match relative path names such as ./ls or ../bin/ls.
1055 This has security implications when path names that
1056 include globbing characters are used with the negation
1057 operator, ‘!’, as such rules can be trivially bypassed.
1058 As such, this flag should not be used when the sudoers
1059 file contains rules that contain negated path names
1060 which include globbing characters. This flag is off by
1061 default.
1062
1063 fqdn Set this flag if you want to put fully qualified host
1064 names in the sudoers file when the local host name (as
1065 returned by the hostname command) does not contain the
1066 domain name. In other words, instead of myhost you
1067 would use myhost.mydomain.edu. You may still use the
1068 short form if you wish (and even mix the two). This
1069 flag is only effective when the “canonical” host name,
1070 as returned by the getaddrinfo() or gethostbyname()
1071 function, is a fully-qualified domain name. This is
1072 usually the case when the system is configured to use
1073 DNS for host name resolution.
1074
1075 If the system is configured to use the /etc/hosts file
1076 in preference to DNS, the “canonical” host name may not
1077 be fully-qualified. The order that sources are queried
1078 for host name resolution is usually specified in the
1079 /etc/nsswitch.conf, /etc/netsvc.conf, /etc/host.conf,
1080 or, in some cases, /etc/resolv.conf file. In the
1081 /etc/hosts file, the first host name of the entry is
1082 considered to be the “canonical” name; subsequent names
1083 are aliases that are not used by sudoers. For example,
1084 the following hosts file line for the machine “xyzzy”
1085 has the fully-qualified domain name as the “canonical”
1086 host name, and the short version as an alias.
1087
1088 192.168.1.1 xyzzy.sudo.ws xyzzy
1089
1090 If the machine's hosts file entry is not formatted
1091 properly, the fqdn flag will not be effective if it is
1092 queried before DNS.
1093
1094 Beware that when using DNS for host name resolution,
1095 turning on fqdn requires sudoers to make DNS lookups
1096 which renders sudo unusable if DNS stops working (for
1097 example if the machine is disconnected from the net‐
1098 work). Also note that just like with the hosts file,
1099 you must use the “canonical” name as DNS knows it.
1100 That is, you may not use a host alias (CNAME entry) due
1101 to performance issues and the fact that there is no way
1102 to get all aliases from DNS.
1103
1104 This flag is off by default.
1105
1106 ignore_audit_errors
1107 Allow commands to be run even if sudoers cannot write
1108 to the audit log. If enabled, an audit log write fail‐
1109 ure is not treated as a fatal error. If disabled, a
1110 command may only be run after the audit event is suc‐
1111 cessfully written. This flag is only effective on sys‐
1112 tems for which sudoers supports audit logging, includ‐
1113 ing FreeBSD, Linux, macOS and Solaris. This flag is on
1114 by default.
1115
1116 ignore_dot If set, sudo will ignore "." or "" (both denoting cur‐
1117 rent directory) in the PATH environment variable; the
1118 PATH itself is not modified. This flag is on by
1119 default.
1120
1121 ignore_iolog_errors
1122 Allow commands to be run even if sudoers cannot write
1123 to the I/O log (local or remote). If enabled, an I/O
1124 log write failure is not treated as a fatal error. If
1125 disabled, the command will be terminated if the I/O log
1126 cannot be written to. This flag is off by default.
1127
1128 ignore_logfile_errors
1129 Allow commands to be run even if sudoers cannot write
1130 to the log file. If enabled, a log file write failure
1131 is not treated as a fatal error. If disabled, a com‐
1132 mand may only be run after the log file entry is suc‐
1133 cessfully written. This flag only has an effect when
1134 sudoers is configured to use file-based logging via the
1135 logfile setting. This flag is on by default.
1136
1137 ignore_local_sudoers
1138 If set via LDAP, parsing of /etc/sudoers will be
1139 skipped. This is intended for Enterprises that wish to
1140 prevent the usage of local sudoers files so that only
1141 LDAP is used. This thwarts the efforts of rogue opera‐
1142 tors who would attempt to add roles to /etc/sudoers.
1143 When this flag is enabled, /etc/sudoers does not even
1144 need to exist. Since this flag tells sudo how to
1145 behave when no specific LDAP entries have been matched,
1146 this sudoOption is only meaningful for the cn=defaults
1147 section. This flag is off by default.
1148
1149 ignore_unknown_defaults
1150 If set, sudo will not produce a warning if it encoun‐
1151 ters an unknown Defaults entry in the sudoers file or
1152 an unknown sudoOption in LDAP. This flag is off by
1153 default.
1154
1155 insults If set, sudo will insult users when they enter an
1156 incorrect password. This flag is off by default.
1157
1158 log_allowed If set, sudoers will log commands allowed by the policy
1159 to the system audit log (where supported) as well as to
1160 syslog and/or a log file. This flag is on by default.
1161
1162 This setting is only supported by version 1.8.29 or
1163 higher.
1164
1165 log_denied If set, sudoers will log commands denied by the policy
1166 to the system audit log (where supported) as well as to
1167 syslog and/or a log file. This flag is on by default.
1168
1169 This setting is only supported by version 1.8.29 or
1170 higher.
1171
1172 log_host If set, the host name will be included in log entries
1173 written to the file configured by the logfile setting.
1174 This flag is off by default.
1175
1176 log_input If set, sudo will run the command in a pseudo-terminal
1177 and log all user input. If the standard input is not
1178 connected to the user's tty, due to I/O redirection or
1179 because the command is part of a pipeline, that input
1180 is also captured and stored in a separate log file.
1181 Anything sent to the standard input will be consumed,
1182 regardless of whether or not the command run via sudo
1183 is actually reading the standard input. This may have
1184 unexpected results when using sudo in a shell script
1185 that expects to process the standard input. For more
1186 information about I/O logging, see the I/O LOG FILES
1187 section. This flag is off by default.
1188
1189 log_output If set, sudo will run the command in a pseudo-terminal
1190 and log all output that is sent to the screen, similar
1191 to the script(1) command. For more information about
1192 I/O logging, see the I/O LOG FILES section. This flag
1193 is off by default.
1194
1195 log_server_keepalive
1196 If set, sudo will enable the TCP keepalive socket
1197 option on the connection to the log server. This
1198 enables the periodic transmission of keepalive messages
1199 to the server. If the server does not respond to a
1200 message, the connection will be closed and the running
1201 command will be killed unless the ignore_iolog_errors
1202 flag is set. This flag is on by default.
1203
1204 log_year If set, the four-digit year will be logged in the (non-
1205 syslog) sudo log file. This flag is off by default.
1206
1207 long_otp_prompt When validating with a One Time Password (OTP) scheme
1208 such as S/Key or OPIE, a two-line prompt is used to
1209 make it easier to cut and paste the challenge to a
1210 local window. It's not as pretty as the default but
1211 some people find it more convenient. This flag is off
1212 by default.
1213
1214 mail_all_cmnds Send mail to the mailto user every time a user attempts
1215 to run a command via sudo (this includes sudoedit). No
1216 mail will be sent if the user runs sudo with the -l or
1217 -v option unless there is an authentication error and
1218 the mail_badpass flag is also set. This flag is off by
1219 default.
1220
1221 mail_always Send mail to the mailto user every time a user runs
1222 sudo. This flag is off by default.
1223
1224 mail_badpass Send mail to the mailto user if the user running sudo
1225 does not enter the correct password. If the command
1226 the user is attempting to run is not permitted by
1227 sudoers and one of the mail_all_cmnds, mail_always,
1228 mail_no_host, mail_no_perms or mail_no_user flags are
1229 set, this flag will have no effect. This flag is off
1230 by default.
1231
1232 mail_no_host If set, mail will be sent to the mailto user if the
1233 invoking user exists in the sudoers file, but is not
1234 allowed to run commands on the current host. This flag
1235 is off by default.
1236
1237 mail_no_perms If set, mail will be sent to the mailto user if the
1238 invoking user is allowed to use sudo but the command
1239 they are trying is not listed in their sudoers file
1240 entry or is explicitly denied. This flag is off by
1241 default.
1242
1243 mail_no_user If set, mail will be sent to the mailto user if the
1244 invoking user is not in the sudoers file. This flag is
1245 on by default.
1246
1247 match_group_by_gid
1248 By default, sudoers will look up each group the user is
1249 a member of by group-ID to determine the group name
1250 (this is only done once). The resulting list of the
1251 user's group names is used when matching groups listed
1252 in the sudoers file. This works well on systems where
1253 the number of groups listed in the sudoers file is
1254 larger than the number of groups a typical user belongs
1255 to. On systems where group lookups are slow, where
1256 users may belong to a large number of groups, and where
1257 the number of groups listed in the sudoers file is rel‐
1258 atively small, it may be prohibitively expensive and
1259 running commands via sudo may take longer than normal.
1260 On such systems it may be faster to use the
1261 match_group_by_gid flag to avoid resolving the user's
1262 group-IDs to group names. In this case, sudoers must
1263 look up any group name listed in the sudoers file and
1264 use the group-ID instead of the group name when deter‐
1265 mining whether the user is a member of the group.
1266
1267 Note that if match_group_by_gid is enabled, group data‐
1268 base lookups performed by sudoers will be keyed by
1269 group name as opposed to group-ID. On systems where
1270 there are multiple sources for the group database, it
1271 is possible to have conflicting group names or group-
1272 IDs in the local /etc/group file and the remote group
1273 database. On such systems, enabling or disabling
1274 match_group_by_gid can be used to choose whether group
1275 database queries are performed by name (enabled) or ID
1276 (disabled), which may aid in working around group entry
1277 conflicts.
1278
1279 The match_group_by_gid flag has no effect when sudoers
1280 data is stored in LDAP. This flag is off by default.
1281
1282 This setting is only supported by version 1.8.18 or
1283 higher.
1284
1285 netgroup_tuple If set, netgroup lookups will be performed using the
1286 full netgroup tuple: host name, user name and domain
1287 (if one is set). Historically, sudo only matched the
1288 user name and domain for netgroups used in a User_List
1289 and only matched the host name and domain for netgroups
1290 used in a Host_List. This flag is off by default.
1291
1292 noexec If set, all commands run via sudo will behave as if the
1293 NOEXEC tag has been set, unless overridden by an EXEC
1294 tag. See the description of EXEC and NOEXEC above as
1295 well as the Preventing shell escapes section at the end
1296 of this manual. This flag is off by default.
1297
1298 pam_acct_mgmt On systems that use PAM for authentication, sudo will
1299 perform PAM account validation for the invoking user by
1300 default. The actual checks performed depend on which
1301 PAM modules are configured. If enabled, account vali‐
1302 dation will be performed regardless of whether or not a
1303 password is required. This flag is on by default.
1304
1305 This setting is only supported by version 1.8.28 or
1306 higher.
1307
1308 pam_rhost On systems that use PAM for authentication, sudo will
1309 set the PAM remote host value to the name of the local
1310 host when the pam_rhost flag is enabled. On Linux sys‐
1311 tems, enabling pam_rhost may result in DNS lookups of
1312 the local host name when PAM is initialized. On
1313 Solaris versions prior to Solaris 8, pam_rhost must be
1314 enabled if pam_ruser is also enabled to avoid a crash
1315 in the Solaris PAM implementation.
1316
1317 This flag is off by default on systems other than
1318 Solaris.
1319
1320 This setting is only supported by version 1.9.0 or
1321 higher.
1322
1323 pam_ruser On systems that use PAM for authentication, sudo will
1324 set the PAM remote user value to the name of the user
1325 that invoked sudo when the pam_ruser flag is enabled.
1326 This flag is on by default.
1327
1328 This setting is only supported by version 1.9.0 or
1329 higher.
1330
1331 pam_session On systems that use PAM for authentication, sudo will
1332 create a new PAM session for the command to be run in.
1333 Unless sudo is given the -i or -s options, PAM session
1334 modules are run with the “silent” flag enabled. This
1335 prevents last login information from being displayed
1336 for every command on some systems. Disabling
1337 pam_session may be needed on older PAM implementations
1338 or on operating systems where opening a PAM session
1339 changes the utmp or wtmp files. If PAM session support
1340 is disabled, resource limits may not be updated for the
1341 command being run. If pam_session, pam_setcred, and
1342 use_pty are disabled and I/O logging has not been con‐
1343 figured, sudo will execute the command directly instead
1344 of running it as a child process. This flag is on by
1345 default.
1346
1347 This setting is only supported by version 1.8.7 or
1348 higher.
1349
1350 pam_setcred On systems that use PAM for authentication, sudo will
1351 attempt to establish credentials for the target user by
1352 default, if supported by the underlying authentication
1353 system. One example of a credential is a Kerberos
1354 ticket. If pam_session, pam_setcred, and use_pty are
1355 disabled and I/O logging has not been configured, sudo
1356 will execute the command directly instead of running it
1357 as a child process. This flag is on by default.
1358
1359 This setting is only supported by version 1.8.8 or
1360 higher.
1361
1362 passprompt_override
1363 If set, the prompt specified by passprompt or the
1364 SUDO_PROMPT environment variable will always be used
1365 and will replace the prompt provided by a PAM module or
1366 other authentication method. This flag is off by
1367 default.
1368
1369 path_info Normally, sudo will tell the user when a command could
1370 not be found in their PATH environment variable. Some
1371 sites may wish to disable this as it could be used to
1372 gather information on the location of executables that
1373 the normal user does not have access to. The disadvan‐
1374 tage is that if the executable is simply not in the
1375 user's PATH, sudo will tell the user that they are not
1376 allowed to run it, which can be confusing. This flag
1377 is on by default.
1378
1379 preserve_groups By default, sudo will initialize the group vector to
1380 the list of groups the target user is in. When
1381 preserve_groups is set, the user's existing group vec‐
1382 tor is left unaltered. The real and effective group-
1383 IDs, however, are still set to match the target user.
1384 This flag is off by default.
1385
1386 pwfeedback By default, sudo reads the password like most other
1387 Unix programs, by turning off echo until the user hits
1388 the return (or enter) key. Some users become confused
1389 by this as it appears to them that sudo has hung at
1390 this point. When pwfeedback is set, sudo will provide
1391 visual feedback when the user presses a key. Note that
1392 this does have a security impact as an onlooker may be
1393 able to determine the length of the password being
1394 entered. This flag is off by default.
1395
1396 requiretty If set, sudo will only run when the user is logged in
1397 to a real tty. When this flag is set, sudo can only be
1398 run from a login session and not via other means such
1399 as cron(8) or cgi-bin scripts. This flag is off by
1400 default.
1401
1402 root_sudo If set, root is allowed to run sudo too. Disabling
1403 this prevents users from “chaining” sudo commands to
1404 get a root shell by doing something like “sudo sudo
1405 /bin/sh”. Note, however, that turning off root_sudo
1406 will also prevent root from running sudoedit. Dis‐
1407 abling root_sudo provides no real additional security;
1408 it exists purely for historical reasons. This flag is
1409 on by default.
1410
1411 rootpw If set, sudo will prompt for the root password instead
1412 of the password of the invoking user when running a
1413 command or editing a file. This flag is off by
1414 default.
1415
1416 runas_allow_unknown_id
1417 If enabled, allow matching of runas user and group IDs
1418 that are not present in the password or group data‐
1419 bases. In addition to explicitly matching unknown user
1420 or group IDs in a Runas_List, this option also allows
1421 the ALL alias to match unknown IDs. This flag is off
1422 by default.
1423
1424 This setting is only supported by version 1.8.30 or
1425 higher. Older versions of sudo always allowed matching
1426 of unknown user and group IDs.
1427
1428 runas_check_shell
1429 If enabled, sudo will only run commands as a user whose
1430 shell appears in the /etc/shells file, even if the
1431 invoking user's Runas_List would otherwise permit it.
1432 If no /etc/shells file is present, a system-dependent
1433 list of built-in default shells is used. On many oper‐
1434 ating systems, system users such as “bin”, do not have
1435 a valid shell and this flag can be used to prevent com‐
1436 mands from being run as those users. This flag is off
1437 by default.
1438
1439 This setting is only supported by version 1.8.30 or
1440 higher.
1441
1442 runaspw If set, sudo will prompt for the password of the user
1443 defined by the runas_default option (defaults to root)
1444 instead of the password of the invoking user when run‐
1445 ning a command or editing a file. This flag is off by
1446 default.
1447
1448 set_home If enabled and sudo is invoked with the -s option, the
1449 HOME environment variable will be set to the home
1450 directory of the target user (which is the root user
1451 unless the -u option is used). This flag is largely
1452 obsolete and has no effect unless the env_reset flag
1453 has been disabled or HOME is present in the env_keep
1454 list, both of which are strongly discouraged. This
1455 flag is off by default.
1456
1457 set_logname Normally, sudo will set the LOGNAME and USER environ‐
1458 ment variables to the name of the target user (usually
1459 root unless the -u option is given). However, since
1460 some programs (including the RCS revision control sys‐
1461 tem) use LOGNAME to determine the real identity of the
1462 user, it may be desirable to change this behavior.
1463 This can be done by negating the set_logname option.
1464 Note that set_logname will have no effect if the
1465 env_reset option has not been disabled and the env_keep
1466 list contains LOGNAME or USER. This flag is on by
1467 default.
1468
1469 set_utmp When enabled, sudo will create an entry in the utmp (or
1470 utmpx) file when a pseudo-terminal is allocated. A
1471 pseudo-terminal is allocated by sudo when it is running
1472 in a terminal and one or more of the log_input,
1473 log_output or use_pty flags is enabled. By default,
1474 the new entry will be a copy of the user's existing
1475 utmp entry (if any), with the tty, time, type and pid
1476 fields updated. This flag is on by default.
1477
1478 setenv Allow the user to disable the env_reset option from the
1479 command line via the -E option. Additionally, environ‐
1480 ment variables set via the command line are not subject
1481 to the restrictions imposed by env_check, env_delete,
1482 or env_keep. As such, only trusted users should be
1483 allowed to set variables in this manner. This flag is
1484 off by default.
1485
1486 shell_noargs If set and sudo is invoked with no arguments it acts as
1487 if the -s option had been given. That is, it runs a
1488 shell as root (the shell is determined by the SHELL
1489 environment variable if it is set, falling back on the
1490 shell listed in the invoking user's /etc/passwd entry
1491 if not). This flag is off by default.
1492
1493 stay_setuid Normally, when sudo executes a command the real and
1494 effective UIDs are set to the target user (root by
1495 default). This option changes that behavior such that
1496 the real UID is left as the invoking user's UID. In
1497 other words, this makes sudo act as a set-user-ID wrap‐
1498 per. This can be useful on systems that disable some
1499 potentially dangerous functionality when a program is
1500 run set-user-ID. This option is only effective on sys‐
1501 tems that support either the setreuid(2) or
1502 setresuid(2) system call. This flag is off by default.
1503
1504 sudoedit_checkdir
1505 If set, sudoedit will check all directory components of
1506 the path to be edited for writability by the invoking
1507 user. Symbolic links will not be followed in writable
1508 directories and sudoedit will refuse to edit a file
1509 located in a writable directory. These restrictions
1510 are not enforced when sudoedit is run by root. On some
1511 systems, if all directory components of the path to be
1512 edited are not readable by the target user, sudoedit
1513 will be unable to edit the file. This flag is on by
1514 default.
1515
1516 This setting was first introduced in version 1.8.15 but
1517 initially suffered from a race condition. The check
1518 for symbolic links in writable intermediate directories
1519 was added in version 1.8.16.
1520
1521 sudoedit_follow By default, sudoedit will not follow symbolic links
1522 when opening files. The sudoedit_follow option can be
1523 enabled to allow sudoedit to open symbolic links. It
1524 may be overridden on a per-command basis by the FOLLOW
1525 and NOFOLLOW tags. This flag is off by default.
1526
1527 This setting is only supported by version 1.8.15 or
1528 higher.
1529
1530 syslog_pid When logging via syslog(3), include the process ID in
1531 the log entry. This flag is off by default.
1532
1533 This setting is only supported by version 1.8.21 or
1534 higher.
1535
1536 targetpw If set, sudo will prompt for the password of the user
1537 specified by the -u option (defaults to root) instead
1538 of the password of the invoking user when running a
1539 command or editing a file. Note that this flag pre‐
1540 cludes the use of a user-ID not listed in the passwd
1541 database as an argument to the -u option. This flag is
1542 off by default.
1543
1544 tty_tickets If set, users must authenticate on a per-tty basis.
1545 With this flag enabled, sudo will use a separate record
1546 in the time stamp file for each terminal. If disabled,
1547 a single record is used for all login sessions.
1548
1549 This option has been superseded by the timestamp_type
1550 option.
1551
1552 umask_override If set, sudo will set the umask as specified in the
1553 sudoers file without modification. This makes it pos‐
1554 sible to specify a umask in the sudoers file that is
1555 more permissive than the user's own umask and matches
1556 historical behavior. If umask_override is not set,
1557 sudo will set the umask to be the union of the user's
1558 umask and what is specified in sudoers. This flag is
1559 off by default.
1560
1561 use_netgroups If set, netgroups (prefixed with ‘+’), may be used in
1562 place of a user or host. For LDAP-based sudoers, net‐
1563 group support requires an expensive sub-string match on
1564 the server unless the NETGROUP_BASE directive is
1565 present in the /etc/ldap.conf file. If netgroups are
1566 not needed, this option can be disabled to reduce the
1567 load on the LDAP server. This flag is on by default.
1568
1569 use_pty If set, and sudo is running in a terminal, the command
1570 will be run in a pseudo-terminal (even if no I/O log‐
1571 ging is being done). If the sudo process is not
1572 attached to a terminal, use_pty has no effect.
1573
1574 A malicious program run under sudo may be capable of
1575 injecting commands into the user's terminal or running
1576 a background process that retains access to the user's
1577 terminal device even after the main program has fin‐
1578 ished executing. By running the command in a separate
1579 pseudo-terminal, this attack is no longer possible.
1580 This flag is off by default.
1581
1582 user_command_timeouts
1583 If set, the user may specify a timeout on the command
1584 line. If the timeout expires before the command has
1585 exited, the command will be terminated. If a timeout
1586 is specified both in the sudoers file and on the com‐
1587 mand line, the smaller of the two timeouts will be
1588 used. See the Timeout_Spec section for a description
1589 of the timeout syntax. This flag is off by default.
1590
1591 This setting is only supported by version 1.8.20 or
1592 higher.
1593
1594 utmp_runas If set, sudo will store the name of the runas user when
1595 updating the utmp (or utmpx) file. By default, sudo
1596 stores the name of the invoking user. This flag is off
1597 by default.
1598
1599 visiblepw By default, sudo will refuse to run if the user must
1600 enter a password but it is not possible to disable echo
1601 on the terminal. If the visiblepw flag is set, sudo
1602 will prompt for a password even when it would be visi‐
1603 ble on the screen. This makes it possible to run
1604 things like “ssh somehost sudo ls” since by default,
1605 ssh(1) does not allocate a tty when running a command.
1606 This flag is off by default.
1607
1608 Integers:
1609
1610 closefrom Before it executes a command, sudo will close all open
1611 file descriptors other than standard input, standard
1612 output and standard error (ie: file descriptors 0-2).
1613 The closefrom option can be used to specify a different
1614 file descriptor at which to start closing. The default
1615 is 3.
1616
1617 command_timeout The maximum amount of time a command is allowed to run
1618 before it is terminated. See the Timeout_Spec section
1619 for a description of the timeout syntax.
1620
1621 This setting is only supported by version 1.8.20 or
1622 higher.
1623
1624 log_server_timeout
1625 The maximum amount of time to wait when connecting to a
1626 log server or waiting for a server response. See the
1627 Timeout_Spec section for a description of the timeout
1628 syntax. The default value is 30 seconds.
1629
1630 This setting is only supported by version 1.9.0 or
1631 higher.
1632
1633 maxseq The maximum sequence number that will be substituted
1634 for the “%{seq}” escape in the I/O log file (see the
1635 iolog_dir description below for more information).
1636 While the value substituted for “%{seq}” is in base 36,
1637 maxseq itself should be expressed in decimal. Values
1638 larger than 2176782336 (which corresponds to the base
1639 36 sequence number “ZZZZZZ”) will be silently truncated
1640 to 2176782336. The default value is 2176782336.
1641
1642 Once the local sequence number reaches the value of
1643 maxseq, it will “roll over” to zero, after which
1644 sudoers will truncate and re-use any existing I/O log
1645 path names.
1646
1647 This setting is only supported by version 1.8.7 or
1648 higher.
1649
1650 passwd_tries The number of tries a user gets to enter his/her pass‐
1651 word before sudo logs the failure and exits. The
1652 default is 3.
1653
1654 syslog_maxlen On many systems, syslog(3) has a relatively small log
1655 buffer. IETF RFC 5424 states that syslog servers must
1656 support messages of at least 480 bytes and should sup‐
1657 port messages up to 2048 bytes. By default, sudoers
1658 creates log messages up to 980 bytes which corresponds
1659 to the historic BSD syslog implementation which used a
1660 1024 byte buffer to store the message, date, hostname
1661 and program name. To prevent syslog messages from
1662 being truncated, sudoers will split up log messages
1663 that are larger than syslog_maxlen bytes. When a mes‐
1664 sage is split, additional parts will include the string
1665 “(command continued)” after the user name and before
1666 the continued command line arguments.
1667
1668 This setting is only supported by version 1.8.19 or
1669 higher.
1670
1671 Integers that can be used in a boolean context:
1672
1673 loglinelen Number of characters per line for the file log. This
1674 value is used to decide when to wrap lines for nicer
1675 log files. This has no effect on the syslog log file,
1676 only the file log. The default is 80 (use 0 or negate
1677 the option to disable word wrap).
1678
1679 passwd_timeout Number of minutes before the sudo password prompt times
1680 out, or 0 for no timeout. The timeout may include a
1681 fractional component if minute granularity is insuffi‐
1682 cient, for example 2.5. The default is 5.
1683
1684 timestamp_timeout
1685 Number of minutes that can elapse before sudo will ask
1686 for a passwd again. The timeout may include a frac‐
1687 tional component if minute granularity is insufficient,
1688 for example 2.5. The default is 5. Set this to 0 to
1689 always prompt for a password. If set to a value less
1690 than 0 the user's time stamp will not expire until the
1691 system is rebooted. This can be used to allow users to
1692 create or delete their own time stamps via “sudo -v”
1693 and “sudo -k” respectively.
1694
1695 umask File mode creation mask to use when running the com‐
1696 mand. Negate this option or set it to 0777 to prevent
1697 sudoers from changing the umask. Unless the
1698 umask_override flag is set, the actual umask will be
1699 the union of the user's umask and the value of the
1700 umask setting, which defaults to 0022. This guarantees
1701 that sudo never lowers the umask when running a com‐
1702 mand.
1703
1704 If umask is explicitly set in sudoers, it will override
1705 any umask setting in PAM or login.conf. If umask is
1706 not set in sudoers, the umask specified by PAM or
1707 login.conf will take precedence. The umask setting in
1708 PAM is not used for sudoedit, which does not create a
1709 new PAM session.
1710
1711 Strings:
1712
1713 authfail_message Message that is displayed after a user fails to authen‐
1714 ticate. The message may include the ‘%d’ escape which
1715 will expand to the number of failed password attempts.
1716 If set, it overrides the default message, %d incorrect
1717 password attempt(s).
1718
1719 badpass_message Message that is displayed if a user enters an incorrect
1720 password. The default is Sorry, try again. unless
1721 insults are enabled.
1722
1723 editor A colon (‘:’) separated list of editors path names used
1724 by sudoedit and visudo. For sudoedit, this list is
1725 used to find an editor when none of the SUDO_EDITOR,
1726 VISUAL or EDITOR environment variables are set to an
1727 editor that exists and is executable. For visudo, it
1728 is used as a white list of allowed editors; visudo will
1729 choose the editor that matches the user's SUDO_EDITOR,
1730 VISUAL or EDITOR environment variable if possible, or
1731 the first editor in the list that exists and is exe‐
1732 cutable if not. Unless invoked as sudoedit, sudo does
1733 not preserve the SUDO_EDITOR, VISUAL or EDITOR environ‐
1734 ment variables unless they are present in the env_keep
1735 list or the env_reset option is disabled. The default
1736 is /bin/vi.
1737
1738 iolog_dir The top-level directory to use when constructing the
1739 path name for the input/output log directory. Only
1740 used if the log_input or log_output options are enabled
1741 or when the LOG_INPUT or LOG_OUTPUT tags are present
1742 for a command. The session sequence number, if any, is
1743 stored in the directory. The default is
1744 /var/log/sudo-io.
1745
1746 The following percent (‘%’) escape sequences are sup‐
1747 ported:
1748
1749 %{seq}
1750 expanded to a monotonically increasing base-36
1751 sequence number, such as 0100A5, where every two
1752 digits are used to form a new directory, e.g.,
1753 01/00/A5
1754
1755 %{user}
1756 expanded to the invoking user's login name
1757
1758 %{group}
1759 expanded to the name of the invoking user's real
1760 group-ID
1761
1762 %{runas_user}
1763 expanded to the login name of the user the com‐
1764 mand will be run as (e.g., root)
1765
1766 %{runas_group}
1767 expanded to the group name of the user the com‐
1768 mand will be run as (e.g., wheel)
1769
1770 %{hostname}
1771 expanded to the local host name without the
1772 domain name
1773
1774 %{command}
1775 expanded to the base name of the command being
1776 run
1777
1778 In addition, any escape sequences supported by the sys‐
1779 tem's strftime(3) function will be expanded.
1780
1781 To include a literal ‘%’ character, the string ‘%%’
1782 should be used.
1783
1784 iolog_file The path name, relative to iolog_dir, in which to store
1785 input/output logs when the log_input or log_output
1786 options are enabled or when the LOG_INPUT or LOG_OUTPUT
1787 tags are present for a command. Note that iolog_file
1788 may contain directory components. The default is
1789 “%{seq}”.
1790
1791 See the iolog_dir option above for a list of supported
1792 percent (‘%’) escape sequences.
1793
1794 In addition to the escape sequences, path names that
1795 end in six or more Xs will have the Xs replaced with a
1796 unique combination of digits and letters, similar to
1797 the mktemp(3) function.
1798
1799 If the path created by concatenating iolog_dir and
1800 iolog_file already exists, the existing I/O log file
1801 will be truncated and overwritten unless iolog_file
1802 ends in six or more Xs.
1803
1804 iolog_flush If set, sudo will flush I/O log data to disk after each
1805 write instead of buffering it. This makes it possible
1806 to view the logs in real-time as the program is execut‐
1807 ing but may significantly reduce the effectiveness of
1808 I/O log compression. This flag is off by default.
1809
1810 This setting is only supported by version 1.8.20 or
1811 higher.
1812
1813 iolog_group The group name to look up when setting the group-ID on
1814 new I/O log files and directories. If iolog_group is
1815 not set, the primary group-ID of the user specified by
1816 iolog_user is used. If neither iolog_group nor
1817 iolog_user are set, I/O log files and directories are
1818 created with group-ID 0.
1819
1820 This setting is only supported by version 1.8.19 or
1821 higher.
1822
1823 iolog_mode The file mode to use when creating I/O log files. Mode
1824 bits for read and write permissions for owner, group or
1825 other are honored, everything else is ignored. The
1826 file permissions will always include the owner read and
1827 write bits, even if they are not present in the speci‐
1828 fied mode. When creating I/O log directories, search
1829 (execute) bits are added to match the read and write
1830 bits specified by iolog_mode. Defaults to 0600 (read
1831 and write by user only).
1832
1833 This setting is only supported by version 1.8.19 or
1834 higher.
1835
1836 iolog_user The user name to look up when setting the user and
1837 group-IDs on new I/O log files and directories. If
1838 iolog_group is set, it will be used instead of the
1839 user's primary group-ID. By default, I/O log files and
1840 directories are created with user and group-ID 0.
1841
1842 This setting can be useful when the I/O logs are stored
1843 on a Network File System (NFS) share. Having a dedi‐
1844 cated user own the I/O log files means that sudoers
1845 does not write to the log files as user-ID 0, which is
1846 usually not permitted by NFS.
1847
1848 This setting is only supported by version 1.8.19 or
1849 higher.
1850
1851 lecture_status_dir
1852 The directory in which sudo stores per-user lecture
1853 status files. Once a user has received the lecture, a
1854 zero-length file is created in this directory so that
1855 sudo will not lecture the user again. This directory
1856 should not be cleared when the system reboots. The
1857 default is /var/db/sudo/lectured.
1858
1859 log_server_cabundle
1860 The path to a certificate authority bundle file, in PEM
1861 format, to use instead of the system's default certifi‐
1862 cate authority database when authenticating the log
1863 server. The default is to use the system's default
1864 certificate authority database. This setting has no
1865 effect unless the log_server flag is enabled and the
1866 remote log server is secured with TLS.
1867
1868 log_server_peer_cert
1869 The path to the client's certificate file, in PEM for‐
1870 mat. This setting is required when the log_server flag
1871 is enabled and the remote log server is secured with
1872 TLS.
1873
1874 log_server_peer_key
1875 The path to the client's private key file, in PEM for‐
1876 mat. This setting is required when the log_server flag
1877 is enabled and the remote log server is secured with
1878 TLS.
1879
1880 mailsub Subject of the mail sent to the mailto user. The
1881 escape %h will expand to the host name of the machine.
1882 Default is “*** SECURITY information for %h ***”.
1883
1884 noexec_file As of sudo version 1.8.1 this option is no longer sup‐
1885 ported. The path to the noexec file should now be set
1886 in the sudo.conf(5) file.
1887
1888 pam_login_service
1889 On systems that use PAM for authentication, this is the
1890 service name used when the -i option is specified. The
1891 default value is “sudo-i”. See the description of
1892 pam_service for more information.
1893
1894 This setting is only supported by version 1.8.8 or
1895 higher.
1896
1897 pam_service On systems that use PAM for authentication, the service
1898 name specifies the PAM policy to apply. This usually
1899 corresponds to an entry in the pam.conf file or a file
1900 in the /etc/pam.d directory. The default value is
1901 “sudo”.
1902
1903 This setting is only supported by version 1.8.8 or
1904 higher.
1905
1906 passprompt The default prompt to use when asking for a password;
1907 can be overridden via the -p option or the SUDO_PROMPT
1908 environment variable. The following percent (‘%’)
1909 escape sequences are supported:
1910
1911 %H expanded to the local host name including the
1912 domain name (only if the machine's host name is
1913 fully qualified or the fqdn option is set)
1914
1915 %h expanded to the local host name without the
1916 domain name
1917
1918 %p expanded to the user whose password is being
1919 asked for (respects the rootpw, targetpw and
1920 runaspw flags in sudoers)
1921
1922 %U expanded to the login name of the user the com‐
1923 mand will be run as (defaults to root)
1924
1925 %u expanded to the invoking user's login name
1926
1927 %% two consecutive % characters are collapsed into a
1928 single % character
1929
1930 On systems that use PAM for authentication, passprompt
1931 will only be used if the prompt provided by the PAM
1932 module matches the string “Password: ” or “username's
1933 Password: ”. This ensures that the passprompt setting
1934 does not interfere with challenge-response style
1935 authentication. The passprompt_override flag can be
1936 used to change this behavior.
1937
1938 The default value is “[sudo] password for %p: ”.
1939
1940 role The default SELinux role to use when constructing a new
1941 security context to run the command. The default role
1942 may be overridden on a per-command basis in the sudoers
1943 file or via command line options. This option is only
1944 available when sudo is built with SELinux support.
1945
1946 runas_default The default user to run commands as if the -u option is
1947 not specified on the command line. This defaults to
1948 root.
1949
1950 sudoers_locale Locale to use when parsing the sudoers file, logging
1951 commands, and sending email. Note that changing the
1952 locale may affect how sudoers is interpreted. Defaults
1953 to “C”.
1954
1955 timestamp_type sudoers uses per-user time stamp files for credential
1956 caching. The timestamp_type option can be used to
1957 specify the type of time stamp record used. It has the
1958 following possible values:
1959
1960 global A single time stamp record is used for all of a
1961 user's login sessions, regardless of the termi‐
1962 nal or parent process ID. An additional record
1963 is used to serialize password prompts when sudo
1964 is used multiple times in a pipeline, but this
1965 does not affect authentication.
1966
1967 ppid A single time stamp record is used for all pro‐
1968 cesses with the same parent process ID (usually
1969 the shell). Commands run from the same shell
1970 (or other common parent process) will not
1971 require a password for timestamp_timeout min‐
1972 utes (5 by default). Commands run via sudo
1973 with a different parent process ID, for example
1974 from a shell script, will be authenticated sep‐
1975 arately.
1976
1977 tty One time stamp record is used for each termi‐
1978 nal, which means that a user's login sessions
1979 are authenticated separately. If no terminal
1980 is present, the behavior is the same as ppid.
1981 Commands run from the same terminal will not
1982 require a password for timestamp_timeout min‐
1983 utes (5 by default).
1984
1985 kernel The time stamp is stored in the kernel as an
1986 attribute of the terminal device. If no termi‐
1987 nal is present, the behavior is the same as
1988 ppid. Negative timestamp_timeout values are
1989 not supported and positive values are limited
1990 to a maximum of 60 minutes. This is currently
1991 only supported on OpenBSD.
1992
1993 The default value is tty.
1994
1995 This setting is only supported by version 1.8.21 or
1996 higher.
1997
1998 timestampdir The directory in which sudo stores its time stamp
1999 files. This directory should be cleared when the sys‐
2000 tem reboots. The default is /run/sudo/ts.
2001
2002 timestampowner The owner of the lecture status directory, time stamp
2003 directory and all files stored therein. The default is
2004 root.
2005
2006 type The default SELinux type to use when constructing a new
2007 security context to run the command. The default type
2008 may be overridden on a per-command basis in the sudoers
2009 file or via command line options. This option is only
2010 available when sudo is built with SELinux support.
2011
2012 Strings that can be used in a boolean context:
2013
2014 env_file The env_file option specifies the fully qualified path to a
2015 file containing variables to be set in the environment of
2016 the program being run. Entries in this file should either
2017 be of the form “VARIABLE=value” or “export VARIABLE=value”.
2018 The value may optionally be surrounded by single or double
2019 quotes. Variables in this file are only added if the vari‐
2020 able does not already exist in the environment. This file
2021 is considered to be part of the security policy, its con‐
2022 tents are not subject to other sudo environment restric‐
2023 tions such as env_keep and env_check.
2024
2025 exempt_group Users in this group are exempt from password and PATH
2026 requirements. The group name specified should not include
2027 a % prefix. This is not set by default.
2028
2029 fdexec Determines whether sudo will execute a command by its path
2030 or by an open file descriptor. It has the following possi‐
2031 ble values:
2032
2033 always Always execute by file descriptor.
2034
2035 never Never execute by file descriptor.
2036
2037 digest_only
2038 Only execute by file descriptor if the command has
2039 an associated digest in the sudoers file.
2040
2041 The default value is digest_only. This avoids a time of
2042 check versus time of use race condition when the command is
2043 located in a directory writable by the invoking user.
2044
2045 Note that fdexec will change the first element of the argu‐
2046 ment vector for scripts ($0 in the shell) due to the way
2047 the kernel runs script interpreters. Instead of being a
2048 normal path, it will refer to a file descriptor. For exam‐
2049 ple, /dev/fd/4 on Solaris and /proc/self/fd/4 on Linux. A
2050 workaround is to use the SUDO_COMMAND environment variable
2051 instead.
2052
2053 The fdexec setting is only used when the command is matched
2054 by path name. It has no effect if the command is matched
2055 by the built-in ALL alias.
2056
2057 This setting is only supported by version 1.8.20 or higher.
2058 If the operating system does not support the fexecve(2)
2059 system call, this setting has no effect.
2060
2061 group_plugin A string containing a sudoers group plugin with optional
2062 arguments. The string should consist of the plugin path,
2063 either fully-qualified or relative to the /usr/libexec/sudo
2064 directory, followed by any configuration arguments the
2065 plugin requires. These arguments (if any) will be passed
2066 to the plugin's initialization function. If arguments are
2067 present, the string must be enclosed in double quotes ("").
2068
2069 For more information see GROUP PROVIDER PLUGINS.
2070
2071 lecture This option controls when a short lecture will be printed
2072 along with the password prompt. It has the following pos‐
2073 sible values:
2074
2075 always Always lecture the user.
2076
2077 never Never lecture the user.
2078
2079 once Only lecture the user the first time they run sudo.
2080
2081 If no value is specified, a value of once is implied.
2082 Negating the option results in a value of never being used.
2083 The default value is once.
2084
2085 lecture_file Path to a file containing an alternate sudo lecture that
2086 will be used in place of the standard lecture if the named
2087 file exists. By default, sudo uses a built-in lecture.
2088
2089 listpw This option controls when a password will be required when
2090 a user runs sudo with the -l option. It has the following
2091 possible values:
2092
2093 all All the user's sudoers file entries for the cur‐
2094 rent host must have the NOPASSWD flag set to
2095 avoid entering a password.
2096
2097 always The user must always enter a password to use the
2098 -l option.
2099
2100 any At least one of the user's sudoers file entries
2101 for the current host must have the NOPASSWD flag
2102 set to avoid entering a password.
2103
2104 never The user need never enter a password to use the
2105 -l option.
2106
2107 If no value is specified, a value of any is implied.
2108 Negating the option results in a value of never being used.
2109 The default value is any.
2110
2111 logfile Path to the sudo log file (not the syslog log file). Set‐
2112 ting a path turns on logging to a file; negating this
2113 option turns it off. By default, sudo logs via syslog.
2114
2115 mailerflags Flags to use when invoking mailer. Defaults to -t.
2116
2117 mailerpath Path to mail program used to send warning mail. Defaults
2118 to the path to sendmail found at configure time.
2119
2120 mailfrom Address to use for the “from” address when sending warning
2121 and error mail. The address should be enclosed in double
2122 quotes ("") to protect against sudo interpreting the @
2123 sign. Defaults to the name of the user running sudo.
2124
2125 mailto Address to send warning and error mail to. The address
2126 should be enclosed in double quotes ("") to protect against
2127 sudo interpreting the @ sign. Defaults to root.
2128
2129 restricted_env_file
2130 The restricted_env_file option specifies the fully quali‐
2131 fied path to a file containing variables to be set in the
2132 environment of the program being run. Entries in this file
2133 should either be of the form “VARIABLE=value” or “export
2134 VARIABLE=value”. The value may optionally be surrounded by
2135 single or double quotes. Variables in this file are only
2136 added if the variable does not already exist in the envi‐
2137 ronment. Unlike env_file, the file's contents are not
2138 trusted and are processed in a manner similar to that of
2139 the invoking user's environment. If env_reset is enabled,
2140 variables in the file will only be added if they are
2141 matched by either the env_check or env_keep list. If
2142 env_reset is disabled, variables in the file are added as
2143 long as they are not matched by the env_delete list. In
2144 either case, the contents of restricted_env_file are pro‐
2145 cessed before the contents of env_file.
2146
2147 secure_path If set, sudo will use this value in place of the user's
2148 PATH environment variable. This option can be used to
2149 reset the PATH to a known good value that contains directo‐
2150 ries for system administrator commands such as /usr/sbin.
2151
2152 Users in the group specified by the exempt_group option are
2153 not affected by secure_path. This option is not set by
2154 default.
2155
2156 syslog Syslog facility if syslog is being used for logging (negate
2157 to disable syslog logging). Defaults to authpriv.
2158
2159 The following syslog facilities are supported: authpriv (if
2160 your OS supports it), auth, daemon, user, local0, local1,
2161 local2, local3, local4, local5, local6, and local7.
2162
2163 syslog_badpri
2164 Syslog priority to use when the user is not allowed to run
2165 a command or when authentication is unsuccessful. Defaults
2166 to alert.
2167
2168 The following syslog priorities are supported: alert, crit,
2169 debug, emerg, err, info, notice, warning, and none. Negat‐
2170 ing the option or setting it to a value of none will dis‐
2171 able logging of unsuccessful commands.
2172
2173 syslog_goodpri
2174 Syslog priority to use when the user is allowed to run a
2175 command and authentication is successful. Defaults to
2176 notice.
2177
2178 See syslog_badpri for the list of supported syslog priori‐
2179 ties. Negating the option or setting it to a value of none
2180 will disable logging of successful commands.
2181
2182 verifypw This option controls when a password will be required when
2183 a user runs sudo with the -v option. It has the following
2184 possible values:
2185
2186 all All the user's sudoers file entries for the current
2187 host must have the NOPASSWD flag set to avoid
2188 entering a password.
2189
2190 always The user must always enter a password to use the -v
2191 option.
2192
2193 any At least one of the user's sudoers file entries for
2194 the current host must have the NOPASSWD flag set to
2195 avoid entering a password.
2196
2197 never The user need never enter a password to use the -v
2198 option.
2199
2200 If no value is specified, a value of all is implied.
2201 Negating the option results in a value of never being used.
2202 The default value is all.
2203
2204 Lists that can be used in a boolean context:
2205
2206 env_check Environment variables to be removed from the user's
2207 environment unless they are considered “safe”. For all
2208 variables except TZ, “safe” means that the variable's
2209 value does not contain any ‘%’ or ‘/’ characters. This
2210 can be used to guard against printf-style format vul‐
2211 nerabilities in poorly-written programs. The TZ vari‐
2212 able is considered unsafe if any of the following are
2213 true:
2214
2215 · It consists of a fully-qualified path name, option‐
2216 ally prefixed with a colon (‘:’), that does not
2217 match the location of the zoneinfo directory.
2218
2219 · It contains a .. path element.
2220
2221 · It contains white space or non-printable characters.
2222
2223 · It is longer than the value of PATH_MAX.
2224
2225 The argument may be a double-quoted, space-separated
2226 list or a single value without double-quotes. The list
2227 can be replaced, added to, deleted from, or disabled by
2228 using the =, +=, -=, and ! operators respectively.
2229 Regardless of whether the env_reset option is enabled
2230 or disabled, variables specified by env_check will be
2231 preserved in the environment if they pass the aforemen‐
2232 tioned check. The global list of environment variables
2233 to check is displayed when sudo is run by root with the
2234 -V option.
2235
2236 env_delete Environment variables to be removed from the user's
2237 environment when the env_reset option is not in effect.
2238 The argument may be a double-quoted, space-separated
2239 list or a single value without double-quotes. The list
2240 can be replaced, added to, deleted from, or disabled by
2241 using the =, +=, -=, and ! operators respectively. The
2242 global list of environment variables to remove is dis‐
2243 played when sudo is run by root with the -V option.
2244 Note that many operating systems will remove poten‐
2245 tially dangerous variables from the environment of any
2246 set-user-ID process (such as sudo).
2247
2248 env_keep Environment variables to be preserved in the user's
2249 environment when the env_reset option is in effect.
2250 This allows fine-grained control over the environment
2251 sudo-spawned processes will receive. The argument may
2252 be a double-quoted, space-separated list or a single
2253 value without double-quotes. The list can be replaced,
2254 added to, deleted from, or disabled by using the =, +=,
2255 -=, and ! operators respectively. The global list of
2256 variables to keep is displayed when sudo is run by root
2257 with the -V option.
2258
2259 Preserving the HOME environment variable has security
2260 implications since many programs use it when searching
2261 for configuration or data files. Adding HOME to
2262 env_keep may enable a user to run unrestricted commands
2263 via sudo and is strongly discouraged. Users wishing to
2264 edit files with sudo should run sudoedit (or sudo -e)
2265 to get their accustomed editor configuration instead of
2266 invoking the editor directly.
2267
2268 log_servers Starting with sudo 1.9, it is possible to send I/O logs
2269 to a remote server instead of logging them locally.
2270 The log_servers setting specifies one or more server
2271 addresses to use when storing I/O logs remotely. Log
2272 servers must be running sudo_logsrvd or another service
2273 that implements the protocol described by
2274 sudo_logsrv.proto(5). Server addresses should be of
2275 the form “host[:port]”. If no port is specified, port
2276 30344 will be used. The host portion may be a host
2277 name, an IPv4 address, or an IPv6 address in square
2278 brackets.
2279
2280 When log_servers is enabled, I/O logs will not be
2281 logged locally. If no log servers are reachable, the
2282 user will not be able to run a command unless the
2283 ignore_iolog_errors flag is set. If the connection to
2284 the log server is interrupted while the command is run‐
2285 ning, the command will be killed unless
2286 ignore_iolog_errors is set.
2287
2289 The sudoers plugin supports its own plugin interface to allow non-Unix
2290 group lookups which can query a group source other than the standard Unix
2291 group database. This can be used to implement support for the
2292 nonunix_group syntax described earlier.
2293
2294 Group provider plugins are specified via the group_plugin setting. The
2295 argument to group_plugin should consist of the plugin path, either fully-
2296 qualified or relative to the /usr/libexec/sudo directory, followed by any
2297 configuration options the plugin requires. These options (if specified)
2298 will be passed to the plugin's initialization function. If options are
2299 present, the string must be enclosed in double quotes ("").
2300
2301 The following group provider plugins are installed by default:
2302
2303 group_file
2304 The group_file plugin supports an alternate group file that
2305 uses the same syntax as the /etc/group file. The path to the
2306 group file should be specified as an option to the plugin. For
2307 example, if the group file to be used is /etc/sudo-group:
2308
2309 Defaults group_plugin="group_file.so /etc/sudo-group"
2310
2311 system_group
2312 The system_group plugin supports group lookups via the standard
2313 C library functions getgrnam() and getgrid(). This plugin can
2314 be used in instances where the user belongs to groups not
2315 present in the user's supplemental group vector. This plugin
2316 takes no options:
2317
2318 Defaults group_plugin=system_group.so
2319
2320 The group provider plugin API is described in detail in sudo_plugin(5).
2321
2323 sudoers can log events using either syslog(3) or a simple log file. The
2324 log format is almost identical in both cases.
2325
2326 Accepted command log entries
2327 Commands that sudo runs are logged using the following format (split into
2328 multiple lines for readability):
2329
2330 date hostname progname: username : TTY=ttyname ; PWD=cwd ; \
2331 USER=runasuser ; GROUP=runasgroup ; TSID=logid ; \
2332 ENV=env_vars COMMAND=command
2333
2334 Where the fields are as follows:
2335
2336 date The date the command was run. Typically, this is in the
2337 format “MMM, DD, HH:MM:SS”. If logging via syslog(3), the
2338 actual date format is controlled by the syslog daemon. If
2339 logging to a file and the log_year option is enabled, the
2340 date will also include the year.
2341
2342 hostname The name of the host sudo was run on. This field is only
2343 present when logging via syslog(3).
2344
2345 progname The name of the program, usually sudo or sudoedit. This
2346 field is only present when logging via syslog(3).
2347
2348 username The login name of the user who ran sudo.
2349
2350 ttyname The short name of the terminal (e.g., “console”, “tty01”,
2351 or “pts/0”) sudo was run on, or “unknown” if there was no
2352 terminal present.
2353
2354 cwd The current working directory that sudo was run in.
2355
2356 runasuser The user the command was run as.
2357
2358 runasgroup The group the command was run as if one was specified on
2359 the command line.
2360
2361 logid An I/O log identifier that can be used to replay the com‐
2362 mand's output. This is only present when the log_input or
2363 log_output option is enabled.
2364
2365 env_vars A list of environment variables specified on the command
2366 line, if specified.
2367
2368 command The actual command that was executed.
2369
2370 Messages are logged using the locale specified by sudoers_locale, which
2371 defaults to the “C” locale.
2372
2373 Denied command log entries
2374 If the user is not allowed to run the command, the reason for the denial
2375 will follow the user name. Possible reasons include:
2376
2377 user NOT in sudoers
2378 The user is not listed in the sudoers file.
2379
2380 user NOT authorized on host
2381 The user is listed in the sudoers file but is not allowed to run com‐
2382 mands on the host.
2383
2384 command not allowed
2385 The user is listed in the sudoers file for the host but they are not
2386 allowed to run the specified command.
2387
2388 3 incorrect password attempts
2389 The user failed to enter their password after 3 tries. The actual num‐
2390 ber of tries will vary based on the number of failed attempts and the
2391 value of the passwd_tries option.
2392
2393 a password is required
2394 The -n option was specified but a password was required.
2395
2396 sorry, you are not allowed to set the following environment variables
2397 The user specified environment variables on the command line that were
2398 not allowed by sudoers.
2399
2400 Error log entries
2401 If an error occurs, sudoers will log a message and, in most cases, send a
2402 message to the administrator via email. Possible errors include:
2403
2404 parse error in /etc/sudoers near line N
2405 sudoers encountered an error when parsing the specified file. In some
2406 cases, the actual error may be one line above or below the line number
2407 listed, depending on the type of error.
2408
2409 problem with defaults entries
2410 The sudoers file contains one or more unknown Defaults settings. This
2411 does not prevent sudo from running, but the sudoers file should be
2412 checked using visudo.
2413
2414 timestamp owner (username): No such user
2415 The time stamp directory owner, as specified by the timestampowner set‐
2416 ting, could not be found in the password database.
2417
2418 unable to open/read /etc/sudoers
2419 The sudoers file could not be opened for reading. This can happen when
2420 the sudoers file is located on a remote file system that maps user-ID 0
2421 to a different value. Normally, sudoers tries to open the sudoers file
2422 using group permissions to avoid this problem. Consider either chang‐
2423 ing the ownership of /etc/sudoers or adding an argument like
2424 “sudoers_uid=N” (where ‘N’ is the user-ID that owns the sudoers file)
2425 to the end of the sudoers Plugin line in the sudo.conf(5) file.
2426
2427 unable to stat /etc/sudoers
2428 The /etc/sudoers file is missing.
2429
2430 /etc/sudoers is not a regular file
2431 The /etc/sudoers file exists but is not a regular file or symbolic
2432 link.
2433
2434 /etc/sudoers is owned by uid N, should be 0
2435 The sudoers file has the wrong owner. If you wish to change the
2436 sudoers file owner, please add “sudoers_uid=N” (where ‘N’ is the user-
2437 ID that owns the sudoers file) to the sudoers Plugin line in the
2438 sudo.conf(5) file.
2439
2440 /etc/sudoers is world writable
2441 The permissions on the sudoers file allow all users to write to it.
2442 The sudoers file must not be world-writable, the default file mode is
2443 0440 (readable by owner and group, writable by none). The default mode
2444 may be changed via the “sudoers_mode” option to the sudoers Plugin line
2445 in the sudo.conf(5) file.
2446
2447 /etc/sudoers is owned by gid N, should be 1
2448 The sudoers file has the wrong group ownership. If you wish to change
2449 the sudoers file group ownership, please add “sudoers_gid=N” (where ‘N’
2450 is the group-ID that owns the sudoers file) to the sudoers Plugin line
2451 in the sudo.conf(5) file.
2452
2453 unable to open /run/sudo/ts/username
2454 sudoers was unable to read or create the user's time stamp file. This
2455 can happen when timestampowner is set to a user other than root and the
2456 mode on /run/sudo is not searchable by group or other. The default
2457 mode for /run/sudo is 0711.
2458
2459 unable to write to /run/sudo/ts/username
2460 sudoers was unable to write to the user's time stamp file.
2461
2462 /run/sudo/ts is owned by uid X, should be Y
2463 The time stamp directory is owned by a user other than timestampowner.
2464 This can occur when the value of timestampowner has been changed.
2465 sudoers will ignore the time stamp directory until the owner is cor‐
2466 rected.
2467
2468 /run/sudo/ts is group writable
2469 The time stamp directory is group-writable; it should be writable only
2470 by timestampowner. The default mode for the time stamp directory is
2471 0700. sudoers will ignore the time stamp directory until the mode is
2472 corrected.
2473
2474 Notes on logging via syslog
2475 By default, sudoers logs messages via syslog(3). The date, hostname, and
2476 progname fields are added by the system's syslog() function, not sudoers
2477 itself. As such, they may vary in format on different systems.
2478
2479 The maximum size of syslog messages varies from system to system. The
2480 syslog_maxlen setting can be used to change the maximum syslog message
2481 size from the default value of 980 bytes. For more information, see the
2482 description of syslog_maxlen.
2483
2484 Notes on logging to a file
2485 If the logfile option is set, sudoers will log to a local file, such as
2486 /var/log/sudo. When logging to a file, sudoers uses a format similar to
2487 syslog(3), with a few important differences:
2488
2489 1. The progname and hostname fields are not present.
2490
2491 2. If the log_year option is enabled, the date will also include the
2492 year.
2493
2494 3. Lines that are longer than loglinelen characters (80 by default) are
2495 word-wrapped and continued on the next line with a four character
2496 indent. This makes entries easier to read for a human being, but
2497 makes it more difficult to use grep(1) on the log files. If the
2498 loglinelen option is set to 0 (or negated with a ‘!’), word wrap
2499 will be disabled.
2500
2502 When I/O logging is enabled, sudo will run the command in a pseudo-termi‐
2503 nal and log all user input and/or output, depending on which options are
2504 enabled. I/O can be logged either to the local machine or to a remote
2505 log server. For local logs, I/O is logged to the directory specified by
2506 the iolog_dir option (/var/log/sudo-io by default) using a unique session
2507 ID that is included in the sudo log line, prefixed with “TSID=”. The
2508 iolog_file option may be used to control the format of the session ID.
2509 For remote logs, the log_servers setting is used to specify one or more
2510 log servers running sudo_logsrvd or another server that implements the
2511 protocol described by sudo_logsrv.proto(5).
2512
2513 For both local and remote I/O logs, each log is stored in a separate
2514 directory that contains the following files:
2515
2516 log A text file containing information about the command. The
2517 first line consists of the following colon-delimited fields:
2518 the time the command was run, the name of the user who ran
2519 sudo, the name of the target user, the name of the target group
2520 (optional), the terminal that sudo was run from, and the number
2521 of lines and columns of the terminal. The second and third
2522 lines contain the working directory the command was run from
2523 and the path name of the command itself (with arguments if
2524 present).
2525
2526 timing Timing information used to replay the session. Each line con‐
2527 sists of the I/O log entry type and amount of time since the
2528 last entry, followed by type-specific data. The I/O log entry
2529 types and their corresponding type-specific data are:
2530
2531 0 standard input, number of bytes in the entry
2532 1 standard output, number of bytes in the entry
2533 2 standard error, number of bytes in the entry
2534 3 terminal input, number of bytes in the entry
2535 4 terminal output, number of bytes in the entry
2536 5 window change, new number lines and columns
2537 6 bug compatibility for sudo 1.8.7 terminal output
2538 7 command suspend or resume, signal received
2539
2540 ttyin Raw input from the user's terminal, exactly as it was received.
2541 No post-processing is performed. For manual viewing, you may
2542 wish to convert carriage return characters in the log to line
2543 feeds. For example: ‘gunzip -c ttyin | tr "\r" "\n"’
2544
2545 stdin The standard input when no terminal is present, or input redi‐
2546 rected from a pipe or file.
2547
2548 ttyout Output from the pseudo-terminal (what the command writes to the
2549 screen). Note that terminal-specific post-processing is per‐
2550 formed before the data is logged. This means that, for exam‐
2551 ple, line feeds are usually converted to line feed/carriage
2552 return pairs and tabs may be expanded to spaces.
2553
2554 stdout The standard output when no terminal is present, or output
2555 redirected to a pipe or file.
2556
2557 stderr The standard error redirected to a pipe or file.
2558
2559 All files other than log are compressed in gzip format unless the
2560 compress_io flag has been disabled. Due to buffering, it is not normally
2561 possible to display the I/O logs in real-time as the program is execut‐
2562 ing. The I/O log data will not be complete until the program run by sudo
2563 has exited or has been terminated by a signal. The iolog_flush flag can
2564 be used to disable buffering, in which case I/O log data is written to
2565 disk as soon as it is available. The output portion of an I/O log file
2566 can be viewed with the sudoreplay(8) utility, which can also be used to
2567 list or search the available logs.
2568
2569 Note that user input may contain sensitive information such as passwords
2570 (even if they are not echoed to the screen), which will be stored in the
2571 log file unencrypted. In most cases, logging the command output via
2572 log_output or LOG_OUTPUT is all that is required.
2573
2574 Since each session's I/O logs are stored in a separate directory, tradi‐
2575 tional log rotation utilities cannot be used to limit the number of I/O
2576 logs. The simplest way to limit the number of I/O is by setting the
2577 maxseq option to the maximum number of logs you wish to store. Once the
2578 I/O log sequence number reaches maxseq, it will be reset to zero and
2579 sudoers will truncate and re-use any existing I/O logs.
2580
2582 /etc/sudo.conf Sudo front end configuration
2583
2584 /etc/sudoers List of who can run what
2585
2586 /etc/group Local groups file
2587
2588 /etc/netgroup List of network groups
2589
2590 /var/log/sudo-io I/O log files
2591
2592 /run/sudo/ts Directory containing time stamps for the
2593 sudoers security policy
2594
2595 /var/db/sudo/lectured Directory containing lecture status files for
2596 the sudoers security policy
2597
2598 /etc/environment Initial environment for -i mode on AIX and
2599 Linux systems
2600
2602 Below are example sudoers file entries. Admittedly, some of these are a
2603 bit contrived. First, we allow a few environment variables to pass and
2604 then define our aliases:
2605
2606 # Run X applications through sudo; HOME is used to find the
2607 # .Xauthority file. Note that other programs use HOME to find
2608 # configuration files and this may lead to privilege escalation!
2609 Defaults env_keep += "DISPLAY HOME"
2610
2611 # User alias specification
2612 User_Alias FULLTIMERS = millert, mikef, dowdy
2613 User_Alias PARTTIMERS = bostley, jwfox, crawl
2614 User_Alias WEBMASTERS = will, wendy, wim
2615
2616 # Runas alias specification
2617 Runas_Alias OP = root, operator
2618 Runas_Alias DB = oracle, sybase
2619 Runas_Alias ADMINGRP = adm, oper
2620
2621 # Host alias specification
2622 Host_Alias SPARC = bigtime, eclipse, moet, anchor :\
2623 SGI = grolsch, dandelion, black :\
2624 ALPHA = widget, thalamus, foobar :\
2625 HPPA = boa, nag, python
2626 Host_Alias CUNETS = 128.138.0.0/255.255.0.0
2627 Host_Alias CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
2628 Host_Alias SERVERS = master, mail, www, ns
2629 Host_Alias CDROM = orion, perseus, hercules
2630
2631 # Cmnd alias specification
2632 Cmnd_Alias DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\
2633 /usr/sbin/restore, /usr/sbin/rrestore,\
2634 sha224:0GomF8mNN3wlDt1HD9XldjJ3SNgpFdbjO1+NsQ== \
2635 /home/operator/bin/start_backups
2636 Cmnd_Alias KILL = /usr/bin/kill
2637 Cmnd_Alias PRINTING = /usr/sbin/lpc, /usr/bin/lprm
2638 Cmnd_Alias SHUTDOWN = /usr/sbin/shutdown
2639 Cmnd_Alias HALT = /usr/sbin/halt
2640 Cmnd_Alias REBOOT = /usr/sbin/reboot
2641 Cmnd_Alias SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh,\
2642 /usr/local/bin/tcsh, /usr/bin/rsh,\
2643 /usr/local/bin/zsh
2644 Cmnd_Alias SU = /usr/bin/su
2645 Cmnd_Alias PAGERS = /usr/bin/more, /usr/bin/pg, /usr/bin/less
2646
2647 Here we override some of the compiled in default values. We want sudo to
2648 log via syslog(3) using the auth facility in all cases. We don't want to
2649 subject the full time staff to the sudo lecture, user millert need not
2650 give a password, and we don't want to reset the LOGNAME or USER environ‐
2651 ment variables when running commands as root. Additionally, on the
2652 machines in the SERVERS Host_Alias, we keep an additional local log file
2653 and make sure we log the year in each log line since the log entries will
2654 be kept around for several years. Lastly, we disable shell escapes for
2655 the commands in the PAGERS Cmnd_Alias (/usr/bin/more, /usr/bin/pg and
2656 /usr/bin/less). Note that this will not effectively constrain users with
2657 sudo ALL privileges.
2658
2659 # Override built-in defaults
2660 Defaults syslog=auth
2661 Defaults>root !set_logname
2662 Defaults:FULLTIMERS !lecture
2663 Defaults:millert !authenticate
2664 Defaults@SERVERS log_year, logfile=/var/log/sudo.log
2665 Defaults!PAGERS noexec
2666
2667 The User specification is the part that actually determines who may run
2668 what.
2669
2670 root ALL = (ALL) ALL
2671 %wheel ALL = (ALL) ALL
2672
2673 We let root and any user in group wheel run any command on any host as
2674 any user.
2675
2676 FULLTIMERS ALL = NOPASSWD: ALL
2677
2678 Full time sysadmins (millert, mikef, and dowdy) may run any command on
2679 any host without authenticating themselves.
2680
2681 PARTTIMERS ALL = ALL
2682
2683 Part time sysadmins bostley, jwfox, and crawl) may run any command on any
2684 host but they must authenticate themselves first (since the entry lacks
2685 the NOPASSWD tag).
2686
2687 jack CSNETS = ALL
2688
2689 The user jack may run any command on the machines in the CSNETS alias
2690 (the networks 128.138.243.0, 128.138.204.0, and 128.138.242.0). Of those
2691 networks, only 128.138.204.0 has an explicit netmask (in CIDR notation)
2692 indicating it is a class C network. For the other networks in CSNETS,
2693 the local machine's netmask will be used during matching.
2694
2695 lisa CUNETS = ALL
2696
2697 The user lisa may run any command on any host in the CUNETS alias (the
2698 class B network 128.138.0.0).
2699
2700 operator ALL = DUMPS, KILL, SHUTDOWN, HALT, REBOOT, PRINTING,\
2701 sudoedit /etc/printcap, /usr/oper/bin/
2702
2703 The operator user may run commands limited to simple maintenance. Here,
2704 those are commands related to backups, killing processes, the printing
2705 system, shutting down the system, and any commands in the directory
2706 /usr/oper/bin/. Note that one command in the DUMPS Cmnd_Alias includes a
2707 sha224 digest, /home/operator/bin/start_backups. This is because the
2708 directory containing the script is writable by the operator user. If the
2709 script is modified (resulting in a digest mismatch) it will no longer be
2710 possible to run it via sudo.
2711
2712 joe ALL = /usr/bin/su operator
2713
2714 The user joe may only su(1) to operator.
2715
2716 pete HPPA = /usr/bin/passwd [A-Za-z]*, !/usr/bin/passwd *root*
2717
2718 %opers ALL = (: ADMINGRP) /usr/sbin/
2719
2720 Users in the opers group may run commands in /usr/sbin/ as themselves
2721 with any group in the ADMINGRP Runas_Alias (the adm and oper groups).
2722
2723 The user pete is allowed to change anyone's password except for root on
2724 the HPPA machines. Because command line arguments are matched as a sin‐
2725 gle, concatenated string, the ‘*’ wildcard will match multiple words.
2726 This example assumes that passwd(1) does not take multiple user names on
2727 the command line. Note that on GNU systems, options to passwd(1) may be
2728 specified after the user argument. As a result, this rule will also
2729 allow:
2730
2731 passwd username --expire
2732
2733 which may not be desirable.
2734
2735 bob SPARC = (OP) ALL : SGI = (OP) ALL
2736
2737 The user bob may run anything on the SPARC and SGI machines as any user
2738 listed in the OP Runas_Alias (root and operator.)
2739
2740 jim +biglab = ALL
2741
2742 The user jim may run any command on machines in the biglab netgroup.
2743 sudo knows that “biglab” is a netgroup due to the ‘+’ prefix.
2744
2745 +secretaries ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser
2746
2747 Users in the secretaries netgroup need to help manage the printers as
2748 well as add and remove users, so they are allowed to run those commands
2749 on all machines.
2750
2751 fred ALL = (DB) NOPASSWD: ALL
2752
2753 The user fred can run commands as any user in the DB Runas_Alias (oracle
2754 or sybase) without giving a password.
2755
2756 john ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*
2757
2758 On the ALPHA machines, user john may su to anyone except root but he is
2759 not allowed to specify any options to the su(1) command.
2760
2761 jen ALL, !SERVERS = ALL
2762
2763 The user jen may run any command on any machine except for those in the
2764 SERVERS Host_Alias (master, mail, www and ns).
2765
2766 jill SERVERS = /usr/bin/, !SU, !SHELLS
2767
2768 For any machine in the SERVERS Host_Alias, jill may run any commands in
2769 the directory /usr/bin/ except for those commands belonging to the SU and
2770 SHELLS Cmnd_Aliases. While not specifically mentioned in the rule, the
2771 commands in the PAGERS Cmnd_Alias all reside in /usr/bin and have the
2772 noexec option set.
2773
2774 steve CSNETS = (operator) /usr/local/op_commands/
2775
2776 The user steve may run any command in the directory /usr/local/op_com‐
2777 mands/ but only as user operator.
2778
2779 matt valkyrie = KILL
2780
2781 On his personal workstation, valkyrie, matt needs to be able to kill hung
2782 processes.
2783
2784 WEBMASTERS www = (www) ALL, (root) /usr/bin/su www
2785
2786 On the host www, any user in the WEBMASTERS User_Alias (will, wendy, and
2787 wim), may run any command as user www (which owns the web pages) or sim‐
2788 ply su(1) to www.
2789
2790 ALL CDROM = NOPASSWD: /sbin/umount /CDROM,\
2791 /sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM
2792
2793 Any user may mount or unmount a CD-ROM on the machines in the CDROM
2794 Host_Alias (orion, perseus, hercules) without entering a password. This
2795 is a bit tedious for users to type, so it is a prime candidate for encap‐
2796 sulating in a shell script.
2797
2799 Limitations of the ‘!’ operator
2800 It is generally not effective to “subtract” commands from ALL using the
2801 ‘!’ operator. A user can trivially circumvent this by copying the
2802 desired command to a different name and then executing that. For exam‐
2803 ple:
2804
2805 bill ALL = ALL, !SU, !SHELLS
2806
2807 Doesn't really prevent bill from running the commands listed in SU or
2808 SHELLS since he can simply copy those commands to a different name, or
2809 use a shell escape from an editor or other program. Therefore, these
2810 kind of restrictions should be considered advisory at best (and rein‐
2811 forced by policy).
2812
2813 In general, if a user has sudo ALL there is nothing to prevent them from
2814 creating their own program that gives them a root shell (or making their
2815 own copy of a shell) regardless of any ‘!’ elements in the user specifi‐
2816 cation.
2817
2818 Security implications of fast_glob
2819 If the fast_glob option is in use, it is not possible to reliably negate
2820 commands where the path name includes globbing (aka wildcard) characters.
2821 This is because the C library's fnmatch(3) function cannot resolve rela‐
2822 tive paths. While this is typically only an inconvenience for rules that
2823 grant privileges, it can result in a security issue for rules that sub‐
2824 tract or revoke privileges.
2825
2826 For example, given the following sudoers file entry:
2827
2828 john ALL = /usr/bin/passwd [a-zA-Z0-9]*, /usr/bin/chsh [a-zA-Z0-9]*,\
2829 /usr/bin/chfn [a-zA-Z0-9]*, !/usr/bin/* root
2830
2831 User john can still run /usr/bin/passwd root if fast_glob is enabled by
2832 changing to /usr/bin and running ./passwd root instead.
2833
2834 Preventing shell escapes
2835 Once sudo executes a program, that program is free to do whatever it
2836 pleases, including run other programs. This can be a security issue
2837 since it is not uncommon for a program to allow shell escapes, which lets
2838 a user bypass sudo's access control and logging. Common programs that
2839 permit shell escapes include shells (obviously), editors, paginators,
2840 mail and terminal programs.
2841
2842 There are two basic approaches to this problem:
2843
2844 restrict Avoid giving users access to commands that allow the user to
2845 run arbitrary commands. Many editors have a restricted mode
2846 where shell escapes are disabled, though sudoedit is a better
2847 solution to running editors via sudo. Due to the large number
2848 of programs that offer shell escapes, restricting users to the
2849 set of programs that do not is often unworkable.
2850
2851 noexec Many systems that support shared libraries have the ability to
2852 override default library functions by pointing an environment
2853 variable (usually LD_PRELOAD) to an alternate shared library.
2854 On such systems, sudo's noexec functionality can be used to
2855 prevent a program run by sudo from executing any other pro‐
2856 grams. Note, however, that this applies only to native dynami‐
2857 cally-linked executables. Statically-linked executables and
2858 foreign executables running under binary emulation are not
2859 affected.
2860
2861 The noexec feature is known to work on SunOS, Solaris, *BSD,
2862 Linux, IRIX, Tru64 UNIX, macOS, HP-UX 11.x and AIX 5.3 and
2863 above. It should be supported on most operating systems that
2864 support the LD_PRELOAD environment variable. Check your oper‐
2865 ating system's manual pages for the dynamic linker (usually
2866 ld.so, ld.so.1, dyld, dld.sl, rld, or loader) to see if
2867 LD_PRELOAD is supported.
2868
2869 On Solaris 10 and higher, noexec uses Solaris privileges
2870 instead of the LD_PRELOAD environment variable.
2871
2872 To enable noexec for a command, use the NOEXEC tag as docu‐
2873 mented in the User Specification section above. Here is that
2874 example again:
2875
2876 aaron shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
2877
2878 This allows user aaron to run /usr/bin/more and /usr/bin/vi
2879 with noexec enabled. This will prevent those two commands from
2880 executing other commands (such as a shell). If you are unsure
2881 whether or not your system is capable of supporting noexec you
2882 can always just try it out and check whether shell escapes work
2883 when noexec is enabled.
2884
2885 Note that restricting shell escapes is not a panacea. Programs running
2886 as root are still capable of many potentially hazardous operations (such
2887 as changing or overwriting files) that could lead to unintended privilege
2888 escalation. In the specific case of an editor, a safer approach is to
2889 give the user permission to run sudoedit (see below).
2890
2891 Secure editing
2892 The sudoers plugin includes sudoedit support which allows users to
2893 securely edit files with the editor of their choice. As sudoedit is a
2894 built-in command, it must be specified in the sudoers file without a
2895 leading path. However, it may take command line arguments just as a nor‐
2896 mal command does. Wildcards used in sudoedit command line arguments are
2897 expected to be path names, so a forward slash (‘/’) will not be matched
2898 by a wildcard.
2899
2900 Unlike other sudo commands, the editor is run with the permissions of the
2901 invoking user and with the environment unmodified. More information may
2902 be found in the description of the -e option in sudo(8).
2903
2904 For example, to allow user operator to edit the “message of the day”
2905 file:
2906
2907 operator sudoedit /etc/motd
2908
2909 The operator user then runs sudoedit as follows:
2910
2911 $ sudoedit /etc/motd
2912
2913 The editor will run as the operator user, not root, on a temporary copy
2914 of /etc/motd. After the file has been edited, /etc/motd will be updated
2915 with the contents of the temporary copy.
2916
2917 Users should never be granted sudoedit permission to edit a file that
2918 resides in a directory the user has write access to, either directly or
2919 via a wildcard. If the user has write access to the directory it is pos‐
2920 sible to replace the legitimate file with a link to another file, allow‐
2921 ing the editing of arbitrary files. To prevent this, starting with ver‐
2922 sion 1.8.16, symbolic links will not be followed in writable directories
2923 and sudoedit will refuse to edit a file located in a writable directory
2924 unless the sudoedit_checkdir option has been disabled or the invoking
2925 user is root. Additionally, in version 1.8.15 and higher, sudoedit will
2926 refuse to open a symbolic link unless either the sudoedit_follow option
2927 is enabled or the sudoedit command is prefixed with the FOLLOW tag in the
2928 sudoers file.
2929
2930 Time stamp file checks
2931 sudoers will check the ownership of its time stamp directory
2932 (/run/sudo/ts by default) and ignore the directory's contents if it is
2933 not owned by root or if it is writable by a user other than root. Older
2934 versions of sudo stored time stamp files in /tmp; this is no longer rec‐
2935 ommended as it may be possible for a user to create the time stamp them‐
2936 selves on systems that allow unprivileged users to change the ownership
2937 of files they create.
2938
2939 While the time stamp directory should be cleared at reboot time, not all
2940 systems contain a /run or /var/run directory. To avoid potential prob‐
2941 lems, sudoers will ignore time stamp files that date from before the
2942 machine booted on systems where the boot time is available.
2943
2944 Some systems with graphical desktop environments allow unprivileged users
2945 to change the system clock. Since sudoers relies on the system clock for
2946 time stamp validation, it may be possible on such systems for a user to
2947 run sudo for longer than timestamp_timeout by setting the clock back. To
2948 combat this, sudoers uses a monotonic clock (which never moves backwards)
2949 for its time stamps if the system supports it.
2950
2951 sudoers will not honor time stamps set far in the future. Time stamps
2952 with a date greater than current_time + 2 * TIMEOUT will be ignored and
2953 sudoers will log and complain.
2954
2955 If the timestamp_type option is set to “tty”, the time stamp record
2956 includes the device number of the terminal the user authenticated with.
2957 This provides per-terminal granularity but time stamp records may still
2958 outlive the user's session.
2959
2960 Unless the timestamp_type option is set to “global”, the time stamp
2961 record also includes the session ID of the process that last authenti‐
2962 cated. This prevents processes in different terminal sessions from using
2963 the same time stamp record. On systems where a process's start time can
2964 be queried, the start time of the session leader is recorded in the time
2965 stamp record. If no terminal is present or the timestamp_type option is
2966 set to “ppid”, the start time of the parent process is used instead. In
2967 most cases this will prevent a time stamp record from being re-used with‐
2968 out the user entering a password when logging out and back in again.
2969
2971 Versions 1.8.4 and higher of the sudoers plugin support a flexible debug‐
2972 ging framework that can help track down what the plugin is doing inter‐
2973 nally if there is a problem. This can be configured in the sudo.conf(5)
2974 file.
2975
2976 The sudoers plugin uses the same debug flag format as the sudo front-end:
2977 subsystem@priority.
2978
2979 The priorities used by sudoers, in order of decreasing severity, are:
2980 crit, err, warn, notice, diag, info, trace and debug. Each priority,
2981 when specified, also includes all priorities higher than it. For exam‐
2982 ple, a priority of notice would include debug messages logged at notice
2983 and higher.
2984
2985 The following subsystems are used by the sudoers plugin:
2986
2987 alias User_Alias, Runas_Alias, Host_Alias and Cmnd_Alias processing
2988
2989 all matches every subsystem
2990
2991 audit BSM and Linux audit code
2992
2993 auth user authentication
2994
2995 defaults sudoers file Defaults settings
2996
2997 env environment handling
2998
2999 ldap LDAP-based sudoers
3000
3001 logging logging support
3002
3003 match matching of users, groups, hosts and netgroups in the sudoers
3004 file
3005
3006 netif network interface handling
3007
3008 nss network service switch handling in sudoers
3009
3010 parser sudoers file parsing
3011
3012 perms permission setting
3013
3014 plugin The equivalent of main for the plugin.
3015
3016 pty pseudo-terminal related code
3017
3018 rbtree redblack tree internals
3019
3020 sssd SSSD-based sudoers
3021
3022 util utility functions
3023 For example:
3024
3025 Debug sudo /var/log/sudo_debug match@info,nss@info
3026
3027 For more information, see the sudo.conf(5) manual.
3028
3030 ssh(1), su(1), fnmatch(3), glob(3), mktemp(3), strftime(3), sudo.conf(5),
3031 sudo_plugin(5), sudoers.ldap(5), sudoers_timestamp(5), sudo(8), visudo(8)
3032
3034 Many people have worked on sudo over the years; this version consists of
3035 code written primarily by:
3036
3037 Todd C. Miller
3038
3039 See the CONTRIBUTORS file in the sudo distribution
3040 (https://www.sudo.ws/contributors.html) for an exhaustive list of people
3041 who have contributed to sudo.
3042
3044 The sudoers file should always be edited by the visudo command which
3045 locks the file and does grammatical checking. It is imperative that the
3046 sudoers file be free of syntax errors since sudo will not run with a syn‐
3047 tactically incorrect sudoers file.
3048
3049 When using netgroups of machines (as opposed to users), if you store
3050 fully qualified host name in the netgroup (as is usually the case), you
3051 either need to have the machine's host name be fully qualified as
3052 returned by the hostname command or use the fqdn option in sudoers.
3053
3055 If you feel you have found a bug in sudo, please submit a bug report at
3056 https://bugzilla.sudo.ws/
3057
3059 Limited free support is available via the sudo-users mailing list, see
3060 https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
3061 the archives.
3062
3064 sudo is provided “AS IS” and any express or implied warranties, includ‐
3065 ing, but not limited to, the implied warranties of merchantability and
3066 fitness for a particular purpose are disclaimed. See the LICENSE file
3067 distributed with sudo or https://www.sudo.ws/license.html for complete
3068 details.
3069
3070Sudo 1.9.0b4 March 10, 2020 Sudo 1.9.0b4