Imported Upstream version 1.6.6
[debian/sudo] / sudoers.man.in
1 .\" Automatically generated by Pod::Man version 1.15
2 .\" Thu Apr 25 09:34:54 2002
3 .\"
4 .\" Standard preamble:
5 .\" ======================================================================
6 .de Sh \" Subsection heading
7 .br
8 .if t .Sp
9 .ne 5
10 .PP
11 \fB\\$1\fR
12 .PP
13 ..
14 .de Sp \" Vertical space (when we can't use .PP)
15 .if t .sp .5v
16 .if n .sp
17 ..
18 .de Ip \" List item
19 .br
20 .ie \\n(.$>=3 .ne \\$3
21 .el .ne 3
22 .IP "\\$1" \\$2
23 ..
24 .de Vb \" Begin verbatim text
25 .ft CW
26 .nf
27 .ne \\$1
28 ..
29 .de Ve \" End verbatim text
30 .ft R
31
32 .fi
33 ..
34 .\" Set up some character translations and predefined strings.  \*(-- will
35 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36 .\" double quote, and \*(R" will give a right double quote.  | will give a
37 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used
38 .\" to do unbreakable dashes and therefore won't be available.  \*(C` and
39 .\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
40 .tr \(*W-|\(bv\*(Tr
41 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
42 .ie n \{\
43 .    ds -- \(*W-
44 .    ds PI pi
45 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
47 .    ds L" ""
48 .    ds R" ""
49 .    ds C` 
50 .    ds C' 
51 'br\}
52 .el\{\
53 .    ds -- \|\(em\|
54 .    ds PI \(*p
55 .    ds L" ``
56 .    ds R" ''
57 'br\}
58 .\"
59 .\" If the F register is turned on, we'll generate index entries on stderr
60 .\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
61 .\" index entries marked with X<> in POD.  Of course, you'll have to process
62 .\" the output yourself in some meaningful fashion.
63 .if \nF \{\
64 .    de IX
65 .    tm Index:\\$1\t\\n%\t"\\$2"
66 ..
67 .    nr % 0
68 .    rr F
69 .\}
70 .\"
71 .\" For nroff, turn off justification.  Always turn off hyphenation; it
72 .\" makes way too many mistakes in technical documents.
73 .hy 0
74 .if n .na
75 .\"
76 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
77 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
78 .bd B 3
79 .    \" fudge factors for nroff and troff
80 .if n \{\
81 .    ds #H 0
82 .    ds #V .8m
83 .    ds #F .3m
84 .    ds #[ \f1
85 .    ds #] \fP
86 .\}
87 .if t \{\
88 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89 .    ds #V .6m
90 .    ds #F 0
91 .    ds #[ \&
92 .    ds #] \&
93 .\}
94 .    \" simple accents for nroff and troff
95 .if n \{\
96 .    ds ' \&
97 .    ds ` \&
98 .    ds ^ \&
99 .    ds , \&
100 .    ds ~ ~
101 .    ds /
102 .\}
103 .if t \{\
104 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
105 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
106 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
107 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
108 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
109 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
110 .\}
111 .    \" troff and (daisy-wheel) nroff accents
112 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
113 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
114 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
115 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
116 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
117 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
118 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
119 .ds ae a\h'-(\w'a'u*4/10)'e
120 .ds Ae A\h'-(\w'A'u*4/10)'E
121 .    \" corrections for vroff
122 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
123 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
124 .    \" for low resolution devices (crt and lpr)
125 .if \n(.H>23 .if \n(.V>19 \
126 \{\
127 .    ds : e
128 .    ds 8 ss
129 .    ds o a
130 .    ds d- d\h'-1'\(ga
131 .    ds D- D\h'-1'\(hy
132 .    ds th \o'bp'
133 .    ds Th \o'LP'
134 .    ds ae ae
135 .    ds Ae AE
136 .\}
137 .rm #[ #] #H #V #F C
138 .\" ======================================================================
139 .\"
140 .IX Title "sudoers @mansectform@"
141 .TH sudoers @mansectform@ "1.6.6" "April 25, 2002" "MAINTENANCE COMMANDS"
142 .UC
143 .SH "NAME"
144 sudoers \- list of which users may execute what
145 .SH "DESCRIPTION"
146 .IX Header "DESCRIPTION"
147 The \fIsudoers\fR file is composed of two types of entries:
148 aliases (basically variables) and user specifications
149 (which specify who may run what).  The grammar of \fIsudoers\fR
150 will be described below in Extended Backus-Naur Form (\s-1EBNF\s0).
151 Don't despair if you don't know what \s-1EBNF\s0 is; it is fairly
152 simple, and the definitions below are annotated.
153 .Sh "Quick guide to \s-1EBNF\s0"
154 .IX Subsection "Quick guide to EBNF"
155 \&\s-1EBNF\s0 is a concise and exact way of describing the grammar of a language.
156 Each \s-1EBNF\s0 definition is made up of \fIproduction rules\fR.  E.g.,
157 .PP
158 .Vb 1
159 \& symbol ::= definition | alternate1 | alternate2 ...
160 .Ve
161 Each \fIproduction rule\fR references others and thus makes up a
162 grammar for the language.  \s-1EBNF\s0 also contains the following
163 operators, which many readers will recognize from regular
164 expressions.  Do not, however, confuse them with \*(L"wildcard\*(R"
165 characters, which have different meanings.
166 .Ip "\f(CW\*(C`?\*(C'\fR" 8
167 .IX Item "?"
168 Means that the preceding symbol (or group of symbols) is optional.
169 That is, it may appear once or not at all.
170 .Ip "\f(CW\*(C`*\*(C'\fR" 8
171 .IX Item "*"
172 Means that the preceding symbol (or group of symbols) may appear
173 zero or more times.
174 .Ip "\f(CW\*(C`+\*(C'\fR" 8
175 .IX Item "+"
176 Means that the preceding symbol (or group of symbols) may appear
177 one or more times.
178 .PP
179 Parentheses may be used to group symbols together.  For clarity,
180 we will use single quotes ('') to designate what is a verbatim character
181 string (as opposed to a symbol name).
182 .Sh "Aliases"
183 .IX Subsection "Aliases"
184 There are four kinds of aliases: \f(CW\*(C`User_Alias\*(C'\fR, \f(CW\*(C`Runas_Alias\*(C'\fR,
185 \&\f(CW\*(C`Host_Alias\*(C'\fR and \f(CW\*(C`Cmnd_Alias\*(C'\fR.
186 .PP
187 .Vb 4
188 \& Alias ::= 'User_Alias'  User_Alias (':' User_Alias)* |
189 \&           'Runas_Alias' Runas_Alias (':' Runas_Alias)* |
190 \&           'Host_Alias'  Host_Alias (':' Host_Alias)* |
191 \&           'Cmnd_Alias'  Cmnd_Alias (':' Cmnd_Alias)*
192 .Ve
193 .Vb 1
194 \& User_Alias ::= NAME '=' User_List
195 .Ve
196 .Vb 1
197 \& Runas_Alias ::= NAME '=' Runas_List
198 .Ve
199 .Vb 1
200 \& Host_Alias ::= NAME '=' Host_List
201 .Ve
202 .Vb 1
203 \& Cmnd_Alias ::= NAME '=' Cmnd_List
204 .Ve
205 .Vb 1
206 \& NAME ::= [A-Z]([A-Z][0-9]_)*
207 .Ve
208 Each \fIalias\fR definition is of the form
209 .PP
210 .Vb 1
211 \& Alias_Type NAME = item1, item2, ...
212 .Ve
213 where \fIAlias_Type\fR is one of \f(CW\*(C`User_Alias\*(C'\fR, \f(CW\*(C`Runas_Alias\*(C'\fR, \f(CW\*(C`Host_Alias\*(C'\fR,
214 or \f(CW\*(C`Cmnd_Alias\*(C'\fR.  A \f(CW\*(C`NAME\*(C'\fR is a string of uppercase letters, numbers,
215 and the underscore characters ('_').  A \f(CW\*(C`NAME\*(C'\fR \fBmust\fR start with an
216 uppercase letter.  It is possible to put several alias definitions
217 of the same type on a single line, joined by a colon (':').  E.g.,
218 .PP
219 .Vb 1
220 \& Alias_Type NAME = item1, item2, item3 : NAME = item4, item5
221 .Ve
222 The definitions of what constitutes a valid \fIalias\fR member follow.
223 .PP
224 .Vb 2
225 \& User_List ::= User |
226 \&               User ',' User_List
227 .Ve
228 .Vb 4
229 \& User ::= '!'* username |
230 \&          '!'* '%'group |
231 \&          '!'* '+'netgroup |
232 \&          '!'* User_Alias
233 .Ve
234 A \f(CW\*(C`User_List\*(C'\fR is made up of one or more usernames, uids
235 (prefixed with '#'), System groups (prefixed with '%'),
236 netgroups (prefixed with '+') and other aliases.  Each list
237 item may be prefixed with one or more '!' operators.  An odd number
238 of '!' operators negate the value of the item; an even number
239 just cancel each other out.
240 .PP
241 .Vb 2
242 \& Runas_List ::= Runas_User |
243 \&                Runas_User ',' Runas_List
244 .Ve
245 .Vb 5
246 \& Runas_User ::= '!'* username |
247 \&                '!'* '#'uid |
248 \&                '!'* '%'group |
249 \&                '!'* +netgroup |
250 \&                '!'* Runas_Alias
251 .Ve
252 A \f(CW\*(C`Runas_List\*(C'\fR is similar to a \f(CW\*(C`User_List\*(C'\fR except that it can
253 also contain uids (prefixed with '#') and instead of \f(CW\*(C`User_Alias\*(C'\fRes
254 it can contain \f(CW\*(C`Runas_Alias\*(C'\fRes.
255 .PP
256 .Vb 2
257 \& Host_List ::= Host |
258 \&               Host ',' Host_List
259 .Ve
260 .Vb 5
261 \& Host ::= '!'* hostname |
262 \&          '!'* ip_addr |
263 \&          '!'* network(/netmask)? |
264 \&          '!'* '+'netgroup |
265 \&          '!'* Host_Alias
266 .Ve
267 A \f(CW\*(C`Host_List\*(C'\fR is made up of one or more hostnames, \s-1IP\s0 addresses,
268 network numbers, netgroups (prefixed with '+') and other aliases.
269 Again, the value of an item may be negated with the '!' operator.
270 If you do not specify a netmask with a network number, the netmask
271 of the host's ethernet \fIinterface\fR\|(s) will be used when matching.
272 The netmask may be specified either in dotted quad notation (e.g.
273 255.255.255.0) or \s-1CIDR\s0 notation (number of bits, e.g. 24).  A hostname
274 may include shell-style wildcards (see `Wildcards' section below),
275 but unless the \f(CW\*(C`hostname\*(C'\fR command on your machine returns the fully
276 qualified hostname, you'll need to use the \fIfqdn\fR option for wildcards
277 to be useful.
278 .PP
279 .Vb 2
280 \& Cmnd_List ::= Cmnd |
281 \&               Cmnd ',' Cmnd_List
282 .Ve
283 .Vb 3
284 \& commandname ::= filename |
285 \&                 filename args |
286 \&                 filename '""'
287 .Ve
288 .Vb 3
289 \& Cmnd ::= '!'* commandname |
290 \&          '!'* directory |
291 \&          '!'* Cmnd_Alias
292 .Ve
293 A \f(CW\*(C`Cmnd_List\*(C'\fR is a list of one or more commandnames, directories, and other
294 aliases.  A commandname is a fully qualified filename which may include
295 shell-style wildcards (see `Wildcards' section below).  A simple
296 filename allows the user to run the command with any arguments he/she
297 wishes.  However, you may also specify command line arguments (including
298 wildcards).  Alternately, you can specify \f(CW\*(C`""\*(C'\fR to indicate that the command
299 may only be run \fBwithout\fR command line arguments.  A directory is a
300 fully qualified pathname ending in a '/'.  When you specify a directory
301 in a \f(CW\*(C`Cmnd_List\*(C'\fR, the user will be able to run any file within that directory
302 (but not in any subdirectories therein).
303 .PP
304 If a \f(CW\*(C`Cmnd\*(C'\fR has associated command line arguments, then the arguments
305 in the \f(CW\*(C`Cmnd\*(C'\fR must match exactly those given by the user on the command line
306 (or match the wildcards if there are any).  Note that the following
307 characters must be escaped with a '\e' if they are used in command
308 arguments: ',', ':', '=', '\e'.
309 .Sh "Defaults"
310 .IX Subsection "Defaults"
311 Certain configuration options may be changed from their default
312 values at runtime via one or more \f(CW\*(C`Default_Entry\*(C'\fR lines.  These
313 may affect all users on any host, all users on a specific host,
314 or just a specific user.  When multiple entries match, they are
315 applied in order.  Where there are conflicting values, the last
316 value on a matching line takes effect.
317 .PP
318 .Vb 3
319 \& Default_Type ::= 'Defaults' ||
320 \&                  'Defaults' ':' User ||
321 \&                  'Defaults' '@' Host
322 .Ve
323 .Vb 1
324 \& Default_Entry ::= Default_Type Parameter_List
325 .Ve
326 .Vb 4
327 \& Parameter ::= Parameter '=' Value ||
328 \&               Parameter '+=' Value ||
329 \&               Parameter '-=' Value ||
330 \&               '!'* Parameter ||
331 .Ve
332 Parameters may be \fBflags\fR, \fBinteger\fR values, \fBstrings\fR, or \fBlists\fR.
333 Flags are implicitly boolean and can be turned off via the '!'
334 operator.  Some integer, string and list parameters may also be
335 used in a boolean context to disable them.  Values may be enclosed
336 in double quotes (\f(CW\*(C`"\*(C'\fR) when they contain multiple words.  Special
337 characters may be escaped with a backslash (\f(CW\*(C`\e\*(C'\fR).
338 .PP
339 Lists have two additional assignment operators, \f(CW\*(C`+=\*(C'\fR and \f(CW\*(C`\-=\*(C'\fR.
340 These operators are used to add to and delete from a list respectively.
341 It is not an error to use the \f(CW\*(C`\-=\*(C'\fR operator to remove an element
342 that does not exist in a list.
343 .PP
344 Note that since the \fIsudoers\fR file is parsed in order the best place
345 to put the Defaults section is after the Host, User, and Cmnd aliases
346 but before the user specifications.
347 .PP
348 \&\fBFlags\fR:
349 .Ip "long_otp_prompt" 12
350 .IX Item "long_otp_prompt"
351 When validating with a One Time Password scheme (\fBS/Key\fR or \fB\s-1OPIE\s0\fR),
352 a two-line prompt is used to make it easier to cut and paste the
353 challenge to a local window.  It's not as pretty as the default but
354 some people find it more convenient.  This flag is \fI@long_otp_prompt@\fR
355 by default.
356 .Ip "ignore_dot" 12
357 .IX Item "ignore_dot"
358 If set, \fBsudo\fR will ignore '.' or '' (current dir) in the \f(CW\*(C`PATH\*(C'\fR
359 environment variable; the \f(CW\*(C`PATH\*(C'\fR itself is not modified.  This
360 flag is \fI@ignore_dot@\fR by default.
361 .Ip "mail_always" 12
362 .IX Item "mail_always"
363 Send mail to the \fImailto\fR user every time a users runs \fBsudo\fR.
364 This flag is \fIoff\fR by default.
365 .Ip "mail_badpass" 12
366 .IX Item "mail_badpass"
367 Send mail to the \fImailto\fR user if the user running sudo does not
368 enter the correct password.  This flag is \fIoff\fR by default.
369 .Ip "mail_no_user" 12
370 .IX Item "mail_no_user"
371 If set, mail will be sent to the \fImailto\fR user if the invoking
372 user is not in the \fIsudoers\fR file.  This flag is \fI@mail_no_user@\fR
373 by default.
374 .Ip "mail_no_host" 12
375 .IX Item "mail_no_host"
376 If set, mail will be sent to the \fImailto\fR user if the invoking
377 user exists in the \fIsudoers\fR file, but is not allowed to run
378 commands on the current host.  This flag is \fI@mail_no_host@\fR by default.
379 .Ip "mail_no_perms" 12
380 .IX Item "mail_no_perms"
381 If set, mail will be sent to the \fImailto\fR user if the invoking
382 user allowed to use \fBsudo\fR but the command they are trying is not
383 listed in their \fIsudoers\fR file entry.  This flag is \fI@mail_no_perms@\fR
384 by default.
385 .Ip "tty_tickets" 12
386 .IX Item "tty_tickets"
387 If set, users must authenticate on a per-tty basis.  Normally,
388 \&\fBsudo\fR uses a directory in the ticket dir with the same name as
389 the user running it.  With this flag enabled, \fBsudo\fR will use a
390 file named for the tty the user is logged in on in that directory.
391 This flag is \fI@tty_tickets@\fR by default.
392 .Ip "lecture" 12
393 .IX Item "lecture"
394 If set, a user will receive a short lecture the first time he/she
395 runs \fBsudo\fR.  This flag is \fI@lecture@\fR by default.
396 .Ip "authenticate" 12
397 .IX Item "authenticate"
398 If set, users must authenticate themselves via a password (or other
399 means of authentication) before they may run commands.  This default
400 may be overridden via the \f(CW\*(C`PASSWD\*(C'\fR and \f(CW\*(C`NOPASSWD\*(C'\fR tags.
401 This flag is \fIon\fR by default.
402 .Ip "root_sudo" 12
403 .IX Item "root_sudo"
404 If set, root is allowed to run \fBsudo\fR too.  Disabling this prevents users
405 from \*(L"chaining\*(R" \fBsudo\fR commands to get a root shell by doing something
406 like \f(CW\*(C`"sudo sudo /bin/sh"\*(C'\fR.
407 This flag is \fIon\fR by default.
408 .Ip "log_host" 12
409 .IX Item "log_host"
410 If set, the hostname will be logged in the (non-syslog) \fBsudo\fR log file.
411 This flag is \fIoff\fR by default.
412 .Ip "log_year" 12
413 .IX Item "log_year"
414 If set, the four-digit year will be logged in the (non-syslog) \fBsudo\fR log file.
415 This flag is \fIoff\fR by default.
416 .Ip "shell_noargs" 12
417 .IX Item "shell_noargs"
418 If set and \fBsudo\fR is invoked with no arguments it acts as if the
419 \&\fB\-s\fR flag had been given.  That is, it runs a shell as root (the
420 shell is determined by the \f(CW\*(C`SHELL\*(C'\fR environment variable if it is
421 set, falling back on the shell listed in the invoking user's
422 /etc/passwd entry if not).  This flag is \fIoff\fR by default.
423 .Ip "set_home" 12
424 .IX Item "set_home"
425 If set and \fBsudo\fR is invoked with the \fB\-s\fR flag the \f(CW\*(C`HOME\*(C'\fR
426 environment variable will be set to the home directory of the target
427 user (which is root unless the \fB\-u\fR option is used).  This effectively
428 makes the \fB\-s\fR flag imply \fB\-H\fR.  This flag is \fIoff\fR by default.
429 .Ip "always_set_home" 12
430 .IX Item "always_set_home"
431 If set, \fBsudo\fR will set the \f(CW\*(C`HOME\*(C'\fR environment variable to the home
432 directory of the target user (which is root unless the \fB\-u\fR option is used).
433 This effectively means that the \fB\-H\fR flag is always implied.
434 This flag is \fIoff\fR by default.
435 .Ip "path_info" 12
436 .IX Item "path_info"
437 Normally, \fBsudo\fR will tell the user when a command could not be
438 found in their \f(CW\*(C`PATH\*(C'\fR environment variable.  Some sites may wish
439 to disable this as it could be used to gather information on the
440 location of executables that the normal user does not have access
441 to.  The disadvantage is that if the executable is simply not in
442 the user's \f(CW\*(C`PATH\*(C'\fR, \fBsudo\fR will tell the user that they are not
443 allowed to run it, which can be confusing.  This flag is \fIoff\fR by
444 default.
445 .Ip "preserve_groups" 12
446 .IX Item "preserve_groups"
447 By default \fBsudo\fR will initialize the group vector to the list of
448 groups the target user is in.  When \fIpreserve_groups\fR is set, the
449 user's existing group vector is left unaltered.  The real and
450 effective group IDs, however, are still set to match the target
451 user.  This flag is \fIoff\fR by default.
452 .Ip "fqdn" 12
453 .IX Item "fqdn"
454 Set this flag if you want to put fully qualified hostnames in the
455 \&\fIsudoers\fR file.  I.e.: instead of myhost you would use myhost.mydomain.edu.
456 You may still use the short form if you wish (and even mix the two).
457 Beware that turning on \fIfqdn\fR requires \fBsudo\fR to make \s-1DNS\s0 lookups
458 which may make \fBsudo\fR unusable if \s-1DNS\s0 stops working (for example
459 if the machine is not plugged into the network).  Also note that
460 you must use the host's official name as \s-1DNS\s0 knows it.  That is,
461 you may not use a host alias (\f(CW\*(C`CNAME\*(C'\fR entry) due to performance
462 issues and the fact that there is no way to get all aliases from
463 \&\s-1DNS\s0.  If your machine's hostname (as returned by the \f(CW\*(C`hostname\*(C'\fR
464 command) is already fully qualified you shouldn't need to set
465 \&\fIfqdn\fR.  This flag is \fI@fqdn@\fR by default.
466 .Ip "insults" 12
467 .IX Item "insults"
468 If set, \fBsudo\fR will insult users when they enter an incorrect
469 password.  This flag is \fI@insults@\fR by default.
470 .Ip "requiretty" 12
471 .IX Item "requiretty"
472 If set, \fBsudo\fR will only run when the user is logged in to a real
473 tty.  This will disallow things like \f(CW\*(C`"rsh somehost sudo ls"\*(C'\fR since
474 \&\fIrsh\fR\|(1) does not allocate a tty.  Because it is not possible to turn
475 of echo when there is no tty present, some sites may with to set
476 this flag to prevent a user from entering a visible password.  This
477 flag is \fIoff\fR by default.
478 .Ip "env_editor" 12
479 .IX Item "env_editor"
480 If set, \fBvisudo\fR will use the value of the \s-1EDITOR\s0 or \s-1VISUAL\s0
481 environment variables before falling back on the default editor list.
482 Note that this may create a security hole as it allows the user to
483 run any arbitrary command as root without logging.  A safer alternative
484 is to place a colon-separated list of editors in the \f(CW\*(C`editor\*(C'\fR
485 variable.  \fBvisudo\fR will then only use the \s-1EDITOR\s0 or \s-1VISUAL\s0 if
486 they match a value specified in \f(CW\*(C`editor\*(C'\fR.  This flag is \f(CW\*(C`@env_editor@\*(C'\fR by
487 default.
488 .Ip "rootpw" 12
489 .IX Item "rootpw"
490 If set, \fBsudo\fR will prompt for the root password instead of the password
491 of the invoking user.  This flag is \fIoff\fR by default.
492 .Ip "runaspw" 12
493 .IX Item "runaspw"
494 If set, \fBsudo\fR will prompt for the password of the user defined by the
495 \&\fIrunas_default\fR option (defaults to \f(CW\*(C`root\*(C'\fR) instead of the password
496 of the invoking user.  This flag is \fIoff\fR by default.
497 .Ip "targetpw" 12
498 .IX Item "targetpw"
499 If set, \fBsudo\fR will prompt for the password of the user specified by
500 the \fB\-u\fR flag (defaults to \f(CW\*(C`root\*(C'\fR) instead of the password of the
501 invoking user.  This flag is \fIoff\fR by default.
502 .Ip "set_logname" 12
503 .IX Item "set_logname"
504 Normally, \fBsudo\fR will set the \f(CW\*(C`LOGNAME\*(C'\fR and \f(CW\*(C`USER\*(C'\fR environment variables
505 to the name of the target user (usually root unless the \fB\-u\fR flag is given).
506 However, since some programs (including the \s-1RCS\s0 revision control system)
507 use \f(CW\*(C`LOGNAME\*(C'\fR to determine the real identity of the user, it may be desirable
508 to change this behavior.  This can be done by negating the set_logname option.
509 .Ip "stay_setuid" 12
510 .IX Item "stay_setuid"
511 Normally, when \fBsudo\fR executes a command the real and effective
512 UIDs are set to the target user (root by default).  This option
513 changes that behavior such that the real \s-1UID\s0 is left as the invoking
514 user's \s-1UID\s0.  In other words, this makes \fBsudo\fR act as a setuid
515 wrapper.  This can be useful on systems that disable some potentially
516 dangerous functionality when a program is run setuid.  Note, however,
517 that this means that sudo will run with the real uid of the invoking
518 user which may allow that user to kill \fBsudo\fR before it can log a
519 failure, depending on how your \s-1OS\s0 defines the interaction between
520 signals and setuid processes.
521 .Ip "env_reset" 12
522 .IX Item "env_reset"
523 If set, \fBsudo\fR will reset the environment to only contain the
524 following variables: \f(CW\*(C`HOME\*(C'\fR, \f(CW\*(C`LOGNAME\*(C'\fR, \f(CW\*(C`PATH\*(C'\fR, \f(CW\*(C`SHELL\*(C'\fR, \f(CW\*(C`TERM\*(C'\fR,
525 and \f(CW\*(C`USER\*(C'\fR (in addition to the \f(CW\*(C`SUDO_*\*(C'\fR variables).
526 Of these, only \f(CW\*(C`TERM\*(C'\fR is copied unaltered from the old environment.
527 The other variables are set to default values (possibly modified
528 by the value of the \fIset_logname\fR option).  If \fBsudo\fR was compiled
529 with the \f(CW\*(C`SECURE_PATH\*(C'\fR option, its value will be used for the \f(CW\*(C`PATH\*(C'\fR
530 environment variable.
531 Other variables may be preserved with the \fIenv_keep\fR option.
532 .Ip "use_loginclass" 12
533 .IX Item "use_loginclass"
534 If set, \fBsudo\fR will apply the defaults specified for the target user's
535 login class if one exists.  Only available if \fBsudo\fR is configured with
536 the \-\-with-logincap option.  This flag is \fIoff\fR by default.
537 .PP
538 \&\fBIntegers\fR:
539 .Ip "passwd_tries" 12
540 .IX Item "passwd_tries"
541 The number of tries a user gets to enter his/her password before
542 \&\fBsudo\fR logs the failure and exits.  The default is \f(CW\*(C`@passwd_tries@\*(C'\fR.
543 .PP
544 \&\fBIntegers that can be used in a boolean context\fR:
545 .Ip "loglinelen" 12
546 .IX Item "loglinelen"
547 Number of characters per line for the file log.  This value is used
548 to decide when to wrap lines for nicer log files.  This has no
549 effect on the syslog log file, only the file log.  The default is
550 \&\f(CW\*(C`@loglen@\*(C'\fR (use 0 or negate the option to disable word wrap).
551 .Ip "timestamp_timeout" 12
552 .IX Item "timestamp_timeout"
553 Number of minutes that can elapse before \fBsudo\fR will ask for a
554 passwd again.  The default is \f(CW\*(C`@timeout@\*(C'\fR.  Set this to \f(CW\*(C`0\*(C'\fR to always
555 prompt for a password.
556 If set to a value less than \f(CW\*(C`0\*(C'\fR the user's timestamp will never
557 expire.  This can be used to allow users to create or delete their
558 own timestamps via \f(CW\*(C`sudo \-v\*(C'\fR and \f(CW\*(C`sudo \-k\*(C'\fR respectively.
559 .Ip "passwd_timeout" 12
560 .IX Item "passwd_timeout"
561 Number of minutes before the \fBsudo\fR password prompt times out.
562 The default is \f(CW\*(C`@password_timeout@\*(C'\fR, set this to \f(CW\*(C`0\*(C'\fR for no password timeout.
563 .Ip "umask" 12
564 .IX Item "umask"
565 Umask to use when running the command.  Negate this option or set
566 it to 0777 to preserve the user's umask.  The default is \f(CW\*(C`@sudo_umask@\*(C'\fR.
567 .PP
568 \&\fBStrings\fR:
569 .Ip "mailsub" 12
570 .IX Item "mailsub"
571 Subject of the mail sent to the \fImailto\fR user. The escape \f(CW\*(C`%h\*(C'\fR
572 will expand to the hostname of the machine.
573 Default is \f(CW\*(C`@mailsub@\*(C'\fR.
574 .Ip "badpass_message" 12
575 .IX Item "badpass_message"
576 Message that is displayed if a user enters an incorrect password.
577 The default is \f(CW\*(C`@badpass_message@\*(C'\fR unless insults are enabled.
578 .Ip "timestampdir" 12
579 .IX Item "timestampdir"
580 The directory in which \fBsudo\fR stores its timestamp files.
581 The default is \fI@timedir@\fR.
582 .Ip "passprompt" 12
583 .IX Item "passprompt"
584 The default prompt to use when asking for a password; can be overridden
585 via the \fB\-p\fR option or the \f(CW\*(C`SUDO_PROMPT\*(C'\fR environment variable. Supports
586 two escapes: \*(L"%u\*(R" expands to the user's login name and \*(L"%h\*(R" expands
587 to the local hostname.  The default value is \f(CW\*(C`@passprompt@\*(C'\fR.
588 .Ip "runas_default" 12
589 .IX Item "runas_default"
590 The default user to run commands as if the \fB\-u\fR flag is not specified
591 on the command line.  This defaults to \f(CW\*(C`@runas_default@\*(C'\fR.
592 .Ip "syslog_goodpri" 12
593 .IX Item "syslog_goodpri"
594 Syslog priority to use when user authenticates successfully.
595 Defaults to \f(CW\*(C`@goodpri@\*(C'\fR.
596 .Ip "syslog_badpri" 12
597 .IX Item "syslog_badpri"
598 Syslog priority to use when user authenticates unsuccessfully.
599 Defaults to \f(CW\*(C`@badpri@\*(C'\fR.
600 .Ip "editor" 12
601 .IX Item "editor"
602 A colon (':') separated list of editors allowed to be used with
603 \&\fBvisudo\fR.  \fBvisudo\fR will choose the editor that matches the user's
604 \&\s-1USER\s0 environment variable if possible, or the first editor in the
605 list that exists and is executable.  The default is the path to vi
606 on your system.
607 .PP
608 \&\fBStrings that can be used in a boolean context\fR:
609 .Ip "logfile" 12
610 .IX Item "logfile"
611 Path to the \fBsudo\fR log file (not the syslog log file).  Setting a path
612 turns on logging to a file; negating this option turns it off.
613 .Ip "syslog" 12
614 .IX Item "syslog"
615 Syslog facility if syslog is being used for logging (negate to
616 disable syslog logging).  Defaults to \f(CW\*(C`@logfac@\*(C'\fR.
617 .Ip "mailerpath" 12
618 .IX Item "mailerpath"
619 Path to mail program used to send warning mail.
620 Defaults to the path to sendmail found at configure time.
621 .Ip "mailerflags" 12
622 .IX Item "mailerflags"
623 Flags to use when invoking mailer. Defaults to \fB\-t\fR.
624 .Ip "mailto" 12
625 .IX Item "mailto"
626 Address to send warning and error mail to.  The address should
627 be enclosed in double quotes (\f(CW\*(C`"\*(C'\fR) to protect against sudo
628 interpreting the \f(CW\*(C`@\*(C'\fR sign.  Defaults to \f(CW\*(C`@mailto@\*(C'\fR.
629 .Ip "exempt_group" 12
630 .IX Item "exempt_group"
631 Users in this group are exempt from password and \s-1PATH\s0 requirements.
632 This is not set by default.
633 .Ip "verifypw" 12
634 .IX Item "verifypw"
635 This option controls when a password will be required when a user runs
636 \&\fBsudo\fR with the \fB\-v\fR flag.  It has the following possible values:
637 .RS 12
638 .Ip "all" 8
639 .IX Item "all"
640 All the user's \fIsudoers\fR entries for the current host must have
641 the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
642 .Ip "any" 8
643 .IX Item "any"
644 At least one of the user's \fIsudoers\fR entries for the current host
645 must have the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
646 .Ip "never" 8
647 .IX Item "never"
648 The user need never enter a password to use the \fB\-v\fR flag.
649 .Ip "always" 8
650 .IX Item "always"
651 The user must always enter a password to use the \fB\-v\fR flag.
652 .RE
653 .RS 12
654 .Sp
655 The default value is `all'.
656 .RE
657 .Ip "listpw" 12
658 .IX Item "listpw"
659 This option controls when a password will be required when a
660 user runs \fBsudo\fR with the \fB\-l\fR.  It has the following possible values:
661 .RS 12
662 .Ip "all" 8
663 .IX Item "all"
664 All the user's \fIsudoers\fR entries for the current host must have
665 the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
666 .Ip "any" 8
667 .IX Item "any"
668 At least one of the user's \fIsudoers\fR entries for the current host
669 must have the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
670 .Ip "never" 8
671 .IX Item "never"
672 The user need never enter a password to use the \fB\-l\fR flag.
673 .Ip "always" 8
674 .IX Item "always"
675 The user must always enter a password to use the \fB\-l\fR flag.
676 .RE
677 .RS 12
678 .Sp
679 The default value is `any'.
680 .RE
681 .PP
682 \&\fBLists that can be used in a boolean context\fR:
683 .Ip "env_check" 12
684 .IX Item "env_check"
685 Environment variables to be removed from the user's environment if
686 the variable's value contains \f(CW\*(C`%\*(C'\fR or \f(CW\*(C`/\*(C'\fR characters.  This can
687 be used to guard against printf-style format vulnerabilties in
688 poorly-written programs.  The argument may be a double-quoted,
689 space-separated list or a single value without double-quotes.  The
690 list can be replaced, added to, deleted from, or disabled by using
691 the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and \f(CW\*(C`!\*(C'\fR operators respectively.  The default
692 list of environment variable to check is printed when \fBsudo\fR is
693 run by root with the \fI\-V\fR option.
694 .Ip "env_delete" 12
695 .IX Item "env_delete"
696 Environment variables to be removed from the user's environment.
697 The argument may be a double-quoted, space-separated list or a
698 single value without double-quotes.  The list can be replaced, added
699 to, deleted from, or disabled by using the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and
700 \&\f(CW\*(C`!\*(C'\fR operators respectively.  The default list of environment
701 variable to remove is printed when \fBsudo\fR is run by root with the
702 \&\fI\-V\fR option.
703 .Ip "env_keep" 12
704 .IX Item "env_keep"
705 Environment variables to be preserved in the user's environment
706 when the \fIenv_reset\fR option is in effect.  This allows fine-grained
707 control over the environment \fBsudo\fR\-spawned processes will receive.
708 The argument may be a double-quoted, space-separated list or a
709 single value without double-quotes.  The list can be replaced, added
710 to, deleted from, or disabled by using the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and
711 \&\f(CW\*(C`!\*(C'\fR operators respectively.  This list has no default members.
712 .PP
713 When logging via \fIsyslog\fR\|(3), \fBsudo\fR accepts the following values for the syslog
714 facility (the value of the \fBsyslog\fR Parameter): \fBauthpriv\fR (if your \s-1OS\s0
715 supports it), \fBauth\fR, \fBdaemon\fR, \fBuser\fR, \fBlocal0\fR, \fBlocal1\fR, \fBlocal2\fR,
716 \&\fBlocal3\fR, \fBlocal4\fR, \fBlocal5\fR, \fBlocal6\fR, and \fBlocal7\fR.  The following
717 syslog priorities are supported: \fBalert\fR, \fBcrit\fR, \fBdebug\fR, \fBemerg\fR,
718 \&\fBerr\fR, \fBinfo\fR, \fBnotice\fR, and \fBwarning\fR.
719 .Sh "User Specification"
720 .IX Subsection "User Specification"
721 .Vb 2
722 \& User_Spec ::= User_list Host_List '=' Cmnd_Spec_List \e
723 \&               (':' User_Spec)*
724 .Ve
725 .Vb 2
726 \& Cmnd_Spec_List ::= Cmnd_Spec |
727 \&                    Cmnd_Spec ',' Cmnd_Spec_List
728 .Ve
729 .Vb 1
730 \& Cmnd_Spec ::= Runas_Spec? ('NOPASSWD:' | 'PASSWD:')? Cmnd
731 .Ve
732 .Vb 1
733 \& Runas_Spec ::= '(' Runas_List ')'
734 .Ve
735 A \fBuser specification\fR determines which commands a user may run
736 (and as what user) on specified hosts.  By default, commands are
737 run as \fBroot\fR, but this can be changed on a per-command basis.
738 .PP
739 Let's break that down into its constituent parts:
740 .Sh "Runas_Spec"
741 .IX Subsection "Runas_Spec"
742 A \f(CW\*(C`Runas_Spec\*(C'\fR is simply a \f(CW\*(C`Runas_List\*(C'\fR (as defined above)
743 enclosed in a set of parentheses.  If you do not specify a
744 \&\f(CW\*(C`Runas_Spec\*(C'\fR in the user specification, a default \f(CW\*(C`Runas_Spec\*(C'\fR
745 of \fBroot\fR will be used.  A \f(CW\*(C`Runas_Spec\*(C'\fR sets the default for
746 commands that follow it.  What this means is that for the entry:
747 .PP
748 .Vb 1
749 \& dgb    boulder = (operator) /bin/ls, /bin/kill, /usr/bin/who
750 .Ve
751 The user \fBdgb\fR may run \fI/bin/ls\fR, \fI/bin/kill\fR, and
752 \&\fI/usr/bin/lprm\fR \*(-- but only as \fBoperator\fR.  E.g.,
753 .PP
754 .Vb 1
755 \&    sudo -u operator /bin/ls.
756 .Ve
757 It is also possible to override a \f(CW\*(C`Runas_Spec\*(C'\fR later on in an
758 entry.  If we modify the entry like so:
759 .PP
760 .Vb 1
761 \& dgb    boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm
762 .Ve
763 Then user \fBdgb\fR is now allowed to run \fI/bin/ls\fR as \fBoperator\fR,
764 but  \fI/bin/kill\fR and \fI/usr/bin/lprm\fR as \fBroot\fR.
765 .Sh "\s-1NOPASSWD\s0 and \s-1PASSWD\s0"
766 .IX Subsection "NOPASSWD and PASSWD"
767 By default, \fBsudo\fR requires that a user authenticate him or herself
768 before running a command.  This behavior can be modified via the
769 \&\f(CW\*(C`NOPASSWD\*(C'\fR tag.  Like a \f(CW\*(C`Runas_Spec\*(C'\fR, the \f(CW\*(C`NOPASSWD\*(C'\fR tag sets
770 a default for the commands that follow it in the \f(CW\*(C`Cmnd_Spec_List\*(C'\fR.
771 Conversely, the \f(CW\*(C`PASSWD\*(C'\fR tag can be used to reverse things.
772 For example:
773 .PP
774 .Vb 1
775 \& ray    rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
776 .Ve
777 would allow the user \fBray\fR to run \fI/bin/kill\fR, \fI/bin/ls\fR, and
778 \&\fI/usr/bin/lprm\fR as root on the machine rushmore as \fBroot\fR without
779 authenticating himself.  If we only want \fBray\fR to be able to
780 run \fI/bin/kill\fR without a password the entry would be:
781 .PP
782 .Vb 1
783 \& ray    rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
784 .Ve
785 Note, however, that the \f(CW\*(C`PASSWD\*(C'\fR tag has no effect on users who are
786 in the group specified by the exempt_group option.
787 .PP
788 By default, if the \f(CW\*(C`NOPASSWD\*(C'\fR tag is applied to any of the entries
789 for a user on the current host, he or she will be able to run
790 \&\f(CW\*(C`sudo \-l\*(C'\fR without a password.  Additionally, a user may only run
791 \&\f(CW\*(C`sudo \-v\*(C'\fR without a password if the \f(CW\*(C`NOPASSWD\*(C'\fR tag is present
792 for all a user's entries that pertain to the current host.
793 This behavior may be overridden via the verifypw and listpw options.
794 .Sh "Wildcards (aka meta characters):"
795 .IX Subsection "Wildcards (aka meta characters):"
796 \&\fBsudo\fR allows shell-style \fIwildcards\fR to be used in pathnames
797 as well as command line arguments in the \fIsudoers\fR file.  Wildcard
798 matching is done via the \fB\s-1POSIX\s0\fR \f(CW\*(C`fnmatch(3)\*(C'\fR routine.  Note that
799 these are \fInot\fR regular expressions.
800 .Ip "\f(CW\*(C`*\*(C'\fR" 8
801 .IX Item "*"
802 Matches any set of zero or more characters.
803 .Ip "\f(CW\*(C`?\*(C'\fR" 8
804 .IX Item "?"
805 Matches any single character.
806 .Ip "\f(CW\*(C`[...]\*(C'\fR" 8
807 .IX Item "[...]"
808 Matches any character in the specified range.
809 .Ip "\f(CW\*(C`[!...]\*(C'\fR" 8
810 .IX Item "[!...]"
811 Matches any character \fBnot\fR in the specified range.
812 .Ip "\f(CW\*(C`\ex\*(C'\fR" 8
813 .IX Item "x"
814 For any character \*(L"x\*(R", evaluates to \*(L"x\*(R".  This is used to
815 escape special characters such as: \*(L"*\*(R", \*(L"?\*(R", \*(L"[\*(R", and \*(L"}\*(R".
816 .PP
817 Note that a forward slash ('/') will \fBnot\fR be matched by
818 wildcards used in the pathname.  When matching the command
819 line arguments, however, as slash \fBdoes\fR get matched by
820 wildcards.  This is to make a path like:
821 .PP
822 .Vb 1
823 \&    /usr/bin/*
824 .Ve
825 match \f(CW\*(C`/usr/bin/who\*(C'\fR but not \f(CW\*(C`/usr/bin/X11/xterm\*(C'\fR.
826 .Sh "Exceptions to wildcard rules:"
827 .IX Subsection "Exceptions to wildcard rules:"
828 The following exceptions apply to the above rules:
829 .if n .Ip "\f(CW""""""""\fR" 8
830 .el .Ip "\f(CW``''\fR" 8
831 .IX Item """""
832 If the empty string \f(CW\*(C`""\*(C'\fR is the only command line argument in the
833 \&\fIsudoers\fR entry it means that command is not allowed to be run
834 with \fBany\fR arguments.
835 .Sh "Other special characters and reserved words:"
836 .IX Subsection "Other special characters and reserved words:"
837 The pound sign ('#') is used to indicate a comment (unless it
838 occurs in the context of a user name and is followed by one or
839 more digits, in which case it is treated as a uid).  Both the
840 comment character and any text after it, up to the end of the line,
841 are ignored.
842 .PP
843 The reserved word \fB\s-1ALL\s0\fR is a built in \fIalias\fR that always causes
844 a match to succeed.  It can be used wherever one might otherwise
845 use a \f(CW\*(C`Cmnd_Alias\*(C'\fR, \f(CW\*(C`User_Alias\*(C'\fR, \f(CW\*(C`Runas_Alias\*(C'\fR, or \f(CW\*(C`Host_Alias\*(C'\fR.
846 You should not try to define your own \fIalias\fR called \fB\s-1ALL\s0\fR as the
847 built in alias will be used in preference to your own.  Please note
848 that using \fB\s-1ALL\s0\fR can be dangerous since in a command context, it
849 allows the user to run \fBany\fR command on the system.
850 .PP
851 An exclamation point ('!') can be used as a logical \fInot\fR operator
852 both in an \fIalias\fR and in front of a \f(CW\*(C`Cmnd\*(C'\fR.  This allows one to
853 exclude certain values.  Note, however, that using a \f(CW\*(C`!\*(C'\fR in
854 conjunction with the built in \f(CW\*(C`ALL\*(C'\fR alias to allow a user to
855 run \*(L"all but a few\*(R" commands rarely works as intended (see \s-1SECURITY\s0
856 \&\s-1NOTES\s0 below).
857 .PP
858 Long lines can be continued with a backslash ('\e') as the last
859 character on the line.
860 .PP
861 Whitespace between elements in a list as well as special syntactic
862 characters in a \fIUser Specification\fR ('=', ':', '(', ')') is optional.
863 .PP
864 The following characters must be escaped with a backslash ('\e') when
865 used as part of a word (e.g. a username or hostname):
866 \&'@', '!', '=', ':', ',', '(', ')', '\e'.
867 .SH "EXAMPLES"
868 .IX Header "EXAMPLES"
869 Below are example \fIsudoers\fR entries.  Admittedly, some of
870 these are a bit contrived.  First, we define our \fIaliases\fR:
871 .PP
872 .Vb 4
873 \& # User alias specification
874 \& User_Alias     FULLTIMERS = millert, mikef, dowdy
875 \& User_Alias     PARTTIMERS = bostley, jwfox, crawl
876 \& User_Alias     WEBMASTERS = will, wendy, wim
877 .Ve
878 .Vb 3
879 \& # Runas alias specification
880 \& Runas_Alias    OP = root, operator
881 \& Runas_Alias    DB = oracle, sybase
882 .Ve
883 .Vb 9
884 \& # Host alias specification
885 \& Host_Alias     SPARC = bigtime, eclipse, moet, anchor :\e
886 \&                SGI = grolsch, dandelion, black :\e
887 \&                ALPHA = widget, thalamus, foobar :\e
888 \&                HPPA = boa, nag, python
889 \& Host_Alias     CUNETS = 128.138.0.0/255.255.0.0
890 \& Host_Alias     CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
891 \& Host_Alias     SERVERS = master, mail, www, ns
892 \& Host_Alias     CDROM = orion, perseus, hercules
893 .Ve
894 .Vb 12
895 \& # Cmnd alias specification
896 \& Cmnd_Alias     DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\e
897 \&                        /usr/sbin/restore, /usr/sbin/rrestore
898 \& Cmnd_Alias     KILL = /usr/bin/kill
899 \& Cmnd_Alias     PRINTING = /usr/sbin/lpc, /usr/bin/lprm
900 \& Cmnd_Alias     SHUTDOWN = /usr/sbin/shutdown
901 \& Cmnd_Alias     HALT = /usr/sbin/halt, /usr/sbin/fasthalt
902 \& Cmnd_Alias     REBOOT = /usr/sbin/reboot, /usr/sbin/fastboot
903 \& Cmnd_Alias     SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh, \e
904 \&                         /usr/local/bin/tcsh, /usr/bin/rsh, \e
905 \&                         /usr/local/bin/zsh
906 \& Cmnd_Alias     SU = /usr/bin/su
907 .Ve
908 Here we override some of the compiled in default values.  We want
909 \&\fBsudo\fR to log via \fIsyslog\fR\|(3) using the \fIauth\fR facility in all cases.
910 We don't want to subject the full time staff to the \fBsudo\fR lecture,
911 and user \fBmillert\fR need not give a password.  In addition, on the
912 machines in the \fI\s-1SERVERS\s0\fR \f(CW\*(C`Host_Alias\*(C'\fR, we keep an additional
913 local log file and make sure we log the year in each log line since
914 the log entries will be kept around for several years.
915 .PP
916 .Vb 5
917 \& # Override built in defaults
918 \& Defaults               syslog=auth
919 \& Defaults:FULLTIMERS    !lecture
920 \& Defaults:millert       !authenticate
921 \& Defaults@SERVERS       log_year, logfile=/var/log/sudo.log
922 .Ve
923 The \fIUser specification\fR is the part that actually determines who may
924 run what.
925 .PP
926 .Vb 2
927 \& root           ALL = (ALL) ALL
928 \& %wheel         ALL = (ALL) ALL
929 .Ve
930 We let \fBroot\fR and any user in group \fBwheel\fR run any command on any
931 host as any user.
932 .PP
933 .Vb 1
934 \& FULLTIMERS     ALL = NOPASSWD: ALL
935 .Ve
936 Full time sysadmins (\fBmillert\fR, \fBmikef\fR, and \fBdowdy\fR) may run any
937 command on any host without authenticating themselves.
938 .PP
939 .Vb 1
940 \& PARTTIMERS     ALL = ALL
941 .Ve
942 Part time sysadmins (\fBbostley\fR, \fBjwfox\fR, and \fBcrawl\fR) may run any
943 command on any host but they must authenticate themselves first
944 (since the entry lacks the \f(CW\*(C`NOPASSWD\*(C'\fR tag).
945 .PP
946 .Vb 1
947 \& jack           CSNETS = ALL
948 .Ve
949 The user \fBjack\fR may run any command on the machines in the \fI\s-1CSNETS\s0\fR alias
950 (the networks \f(CW\*(C`128.138.243.0\*(C'\fR, \f(CW\*(C`128.138.204.0\*(C'\fR, and \f(CW\*(C`128.138.242.0\*(C'\fR).
951 Of those networks, only \f(CW\*(C`128.138.204.0\*(C'\fR has an explicit netmask (in
952 \&\s-1CIDR\s0 notation) indicating it is a class C network.  For the other
953 networks in \fI\s-1CSNETS\s0\fR, the local machine's netmask will be used
954 during matching.
955 .PP
956 .Vb 1
957 \& lisa           CUNETS = ALL
958 .Ve
959 The user \fBlisa\fR may run any command on any host in the \fI\s-1CUNETS\s0\fR alias
960 (the class B network \f(CW\*(C`128.138.0.0\*(C'\fR).
961 .PP
962 .Vb 2
963 \& operator       ALL = DUMPS, KILL, PRINTING, SHUTDOWN, HALT, REBOOT,\e
964 \&                /usr/oper/bin/
965 .Ve
966 The \fBoperator\fR user may run commands limited to simple maintenance.
967 Here, those are commands related to backups, killing processes, the
968 printing system, shutting down the system, and any commands in the
969 directory \fI/usr/oper/bin/\fR.
970 .PP
971 .Vb 1
972 \& joe            ALL = /usr/bin/su operator
973 .Ve
974 The user \fBjoe\fR may only \fIsu\fR\|(1) to operator.
975 .PP
976 .Vb 1
977 \& pete           HPPA = /usr/bin/passwd [A-z]*, !/usr/bin/passwd root
978 .Ve
979 The user \fBpete\fR is allowed to change anyone's password except for
980 root on the \fI\s-1HPPA\s0\fR machines.  Note that this assumes \fIpasswd\fR\|(1)
981 does not take multiple usernames on the command line.
982 .PP
983 .Vb 1
984 \& bob            SPARC = (OP) ALL : SGI = (OP) ALL
985 .Ve
986 The user \fBbob\fR may run anything on the \fI\s-1SPARC\s0\fR and \fI\s-1SGI\s0\fR machines
987 as any user listed in the \fI\s-1OP\s0\fR \f(CW\*(C`Runas_Alias\*(C'\fR (\fBroot\fR and \fBoperator\fR).
988 .PP
989 .Vb 1
990 \& jim            +biglab = ALL
991 .Ve
992 The user \fBjim\fR may run any command on machines in the \fIbiglab\fR netgroup.
993 \&\fBSudo\fR knows that \*(L"biglab\*(R" is a netgroup due to the '+' prefix.
994 .PP
995 .Vb 1
996 \& +secretaries   ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser
997 .Ve
998 Users in the \fBsecretaries\fR netgroup need to help manage the printers
999 as well as add and remove users, so they are allowed to run those
1000 commands on all machines.
1001 .PP
1002 .Vb 1
1003 \& fred           ALL = (DB) NOPASSWD: ALL
1004 .Ve
1005 The user \fBfred\fR can run commands as any user in the \fI\s-1DB\s0\fR \f(CW\*(C`Runas_Alias\*(C'\fR
1006 (\fBoracle\fR or \fBsybase\fR) without giving a password.
1007 .PP
1008 .Vb 1
1009 \& john           ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*
1010 .Ve
1011 On the \fI\s-1ALPHA\s0\fR machines, user \fBjohn\fR may su to anyone except root
1012 but he is not allowed to give \fIsu\fR\|(1) any flags.
1013 .PP
1014 .Vb 1
1015 \& jen            ALL, !SERVERS = ALL
1016 .Ve
1017 The user \fBjen\fR may run any command on any machine except for those
1018 in the \fI\s-1SERVERS\s0\fR \f(CW\*(C`Host_Alias\*(C'\fR (master, mail, www and ns).
1019 .PP
1020 .Vb 1
1021 \& jill           SERVERS = /usr/bin/, !SU, !SHELLS
1022 .Ve
1023 For any machine in the \fI\s-1SERVERS\s0\fR \f(CW\*(C`Host_Alias\*(C'\fR, \fBjill\fR may run
1024 any commands in the directory /usr/bin/ except for those commands
1025 belonging to the \fI\s-1SU\s0\fR and \fI\s-1SHELLS\s0\fR \f(CW\*(C`Cmnd_Aliases\*(C'\fR.
1026 .PP
1027 .Vb 1
1028 \& steve          CSNETS = (operator) /usr/local/op_commands/
1029 .Ve
1030 The user \fBsteve\fR may run any command in the directory /usr/local/op_commands/
1031 but only as user operator.
1032 .PP
1033 .Vb 1
1034 \& matt           valkyrie = KILL
1035 .Ve
1036 On his personal workstation, valkyrie, \fBmatt\fR needs to be able to
1037 kill hung processes.
1038 .PP
1039 .Vb 1
1040 \& WEBMASTERS     www = (www) ALL, (root) /usr/bin/su www
1041 .Ve
1042 On the host www, any user in the \fI\s-1WEBMASTERS\s0\fR \f(CW\*(C`User_Alias\*(C'\fR (will,
1043 wendy, and wim), may run any command as user www (which owns the
1044 web pages) or simply \fIsu\fR\|(1) to www.
1045 .PP
1046 .Vb 2
1047 \& ALL            CDROM = NOPASSWD: /sbin/umount /CDROM,\e
1048 \&                /sbin/mount -o nosuid\e,nodev /dev/cd0a /CDROM
1049 .Ve
1050 Any user may mount or unmount a \s-1CD-ROM\s0 on the machines in the \s-1CDROM\s0
1051 \&\f(CW\*(C`Host_Alias\*(C'\fR (orion, perseus, hercules) without entering a password.
1052 This is a bit tedious for users to type, so it is a prime candidate
1053 for encapsulating in a shell script.
1054 .SH "SECURITY NOTES"
1055 .IX Header "SECURITY NOTES"
1056 It is generally not effective to \*(L"subtract\*(R" commands from \f(CW\*(C`ALL\*(C'\fR
1057 using the '!' operator.  A user can trivially circumvent this
1058 by copying the desired command to a different name and then
1059 executing that.  For example:
1060 .PP
1061 .Vb 1
1062 \&    bill        ALL = ALL, !SU, !SHELLS
1063 .Ve
1064 Doesn't really prevent \fBbill\fR from running the commands listed in
1065 \&\fI\s-1SU\s0\fR or \fI\s-1SHELLS\s0\fR since he can simply copy those commands to a
1066 different name, or use a shell escape from an editor or other
1067 program.  Therefore, these kind of restrictions should be considered
1068 advisory at best (and reinforced by policy).
1069 .SH "CAVEATS"
1070 .IX Header "CAVEATS"
1071 The \fIsudoers\fR file should \fBalways\fR be edited by the \fBvisudo\fR
1072 command which locks the file and does grammatical checking. It is
1073 imperative that \fIsudoers\fR be free of syntax errors since \fBsudo\fR
1074 will not run with a syntactically incorrect \fIsudoers\fR file.
1075 .PP
1076 When using netgroups of machines (as opposed to users), if you
1077 store fully qualified hostnames in the netgroup (as is usually the
1078 case), you either need to have the machine's hostname be fully qualified
1079 as returned by the \f(CW\*(C`hostname\*(C'\fR command or use the \fIfqdn\fR option in
1080 \&\fIsudoers\fR.
1081 .SH "FILES"
1082 .IX Header "FILES"
1083 .Vb 3
1084 \& @sysconfdir@/sudoers           List of who can run what
1085 \& /etc/group             Local groups file
1086 \& /etc/netgroup          List of network groups
1087 .Ve
1088 .SH "SEE ALSO"
1089 .IX Header "SEE ALSO"
1090 \&\fIrsh\fR\|(1), \fIsudo\fR\|(@mansectsu@), \fIvisudo\fR\|(8), \fIsu\fR\|(1), \fIfnmatch\fR\|(3).