Imported Upstream version 1.7.6p1
[debian/sudo] / sudoers.man.in
1 .\" Copyright (c) 1994-1996, 1998-2005, 2007-2011
2 .\"     Todd C. Miller <Todd.Miller@courtesan.com>
3 .\" 
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
7 .\" 
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 .\" 
17 .\" Sponsored in part by the Defense Advanced Research Projects
18 .\" Agency (DARPA) and Air Force Research Laboratory, Air Force
19 .\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
20 .\" 
21 .nr SL @SEMAN@
22 .nr BA @BAMAN@
23 .nr LC @LCMAN@
24 .\"
25 .\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
26 .\"
27 .\" Standard preamble:
28 .\" ========================================================================
29 .de Sp \" Vertical space (when we can't use .PP)
30 .if t .sp .5v
31 .if n .sp
32 ..
33 .de Vb \" Begin verbatim text
34 .ft CW
35 .nf
36 .ne \\$1
37 ..
38 .de Ve \" End verbatim text
39 .ft R
40 .fi
41 ..
42 .\" Set up some character translations and predefined strings.  \*(-- will
43 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
44 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
45 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
46 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
47 .\" nothing in troff, for use with C<>.
48 .tr \(*W-
49 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
50 .ie n \{\
51 .    ds -- \(*W-
52 .    ds PI pi
53 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
54 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
55 .    ds L" ""
56 .    ds R" ""
57 .    ds C` 
58 .    ds C' 
59 'br\}
60 .el\{\
61 .    ds -- \|\(em\|
62 .    ds PI \(*p
63 .    ds L" ``
64 .    ds R" ''
65 'br\}
66 .\"
67 .\" Escape single quotes in literal strings from groff's Unicode transform.
68 .ie \n(.g .ds Aq \(aq
69 .el       .ds Aq '
70 .\"
71 .\" If the F register is turned on, we'll generate index entries on stderr for
72 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
73 .\" entries marked with X<> in POD.  Of course, you'll have to process the
74 .\" output yourself in some meaningful fashion.
75 .ie \nF \{\
76 .    de IX
77 .    tm Index:\\$1\t\\n%\t"\\$2"
78 ..
79 .    nr % 0
80 .    rr F
81 .\}
82 .el \{\
83 .    de IX
84 ..
85 .\}
86 .\"
87 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
88 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
89 .    \" fudge factors for nroff and troff
90 .if n \{\
91 .    ds #H 0
92 .    ds #V .8m
93 .    ds #F .3m
94 .    ds #[ \f1
95 .    ds #] \fP
96 .\}
97 .if t \{\
98 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
99 .    ds #V .6m
100 .    ds #F 0
101 .    ds #[ \&
102 .    ds #] \&
103 .\}
104 .    \" simple accents for nroff and troff
105 .if n \{\
106 .    ds ' \&
107 .    ds ` \&
108 .    ds ^ \&
109 .    ds , \&
110 .    ds ~ ~
111 .    ds /
112 .\}
113 .if t \{\
114 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
115 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
116 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
117 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
118 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
119 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
120 .\}
121 .    \" troff and (daisy-wheel) nroff accents
122 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
123 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
124 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
125 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
126 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
127 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
128 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
129 .ds ae a\h'-(\w'a'u*4/10)'e
130 .ds Ae A\h'-(\w'A'u*4/10)'E
131 .    \" corrections for vroff
132 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
133 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
134 .    \" for low resolution devices (crt and lpr)
135 .if \n(.H>23 .if \n(.V>19 \
136 \{\
137 .    ds : e
138 .    ds 8 ss
139 .    ds o a
140 .    ds d- d\h'-1'\(ga
141 .    ds D- D\h'-1'\(hy
142 .    ds th \o'bp'
143 .    ds Th \o'LP'
144 .    ds ae ae
145 .    ds Ae AE
146 .\}
147 .rm #[ #] #H #V #F C
148 .\" ========================================================================
149 .\"
150 .IX Title "SUDOERS @mansectform@"
151 .TH SUDOERS @mansectform@ "April  9, 2011" "1.7.6" "MAINTENANCE COMMANDS"
152 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
153 .\" way too many mistakes in technical documents.
154 .if n .ad l
155 .nh
156 .SH "NAME"
157 sudoers \- list of which users may execute what
158 .SH "DESCRIPTION"
159 .IX Header "DESCRIPTION"
160 The \fIsudoers\fR file is composed of two types of entries: aliases
161 (basically variables) and user specifications (which specify who
162 may run what).
163 .PP
164 When multiple entries match for a user, they are applied in order.
165 Where there are multiple matches, the last match is used (which is
166 not necessarily the most specific match).
167 .PP
168 The \fIsudoers\fR grammar will be described below in Extended Backus-Naur
169 Form (\s-1EBNF\s0).  Don't despair if you don't know what \s-1EBNF\s0 is; it is
170 fairly simple, and the definitions below are annotated.
171 .SS "Quick guide to \s-1EBNF\s0"
172 .IX Subsection "Quick guide to EBNF"
173 \&\s-1EBNF\s0 is a concise and exact way of describing the grammar of a language.
174 Each \s-1EBNF\s0 definition is made up of \fIproduction rules\fR.  E.g.,
175 .PP
176 .Vb 1
177 \& symbol ::= definition | alternate1 | alternate2 ...
178 .Ve
179 .PP
180 Each \fIproduction rule\fR references others and thus makes up a
181 grammar for the language.  \s-1EBNF\s0 also contains the following
182 operators, which many readers will recognize from regular
183 expressions.  Do not, however, confuse them with \*(L"wildcard\*(R"
184 characters, which have different meanings.
185 .ie n .IP "\*(C`?\*(C'" 4
186 .el .IP "\f(CW\*(C`?\*(C'\fR" 4
187 .IX Item "?"
188 Means that the preceding symbol (or group of symbols) is optional.
189 That is, it may appear once or not at all.
190 .ie n .IP "\*(C`*\*(C'" 4
191 .el .IP "\f(CW\*(C`*\*(C'\fR" 4
192 .IX Item "*"
193 Means that the preceding symbol (or group of symbols) may appear
194 zero or more times.
195 .ie n .IP "\*(C`+\*(C'" 4
196 .el .IP "\f(CW\*(C`+\*(C'\fR" 4
197 .IX Item "+"
198 Means that the preceding symbol (or group of symbols) may appear
199 one or more times.
200 .PP
201 Parentheses may be used to group symbols together.  For clarity,
202 we will use single quotes ('') to designate what is a verbatim character
203 string (as opposed to a symbol name).
204 .SS "Aliases"
205 .IX Subsection "Aliases"
206 There are four kinds of aliases: \f(CW\*(C`User_Alias\*(C'\fR, \f(CW\*(C`Runas_Alias\*(C'\fR,
207 \&\f(CW\*(C`Host_Alias\*(C'\fR and \f(CW\*(C`Cmnd_Alias\*(C'\fR.
208 .PP
209 .Vb 4
210 \& Alias ::= \*(AqUser_Alias\*(Aq  User_Alias (\*(Aq:\*(Aq User_Alias)* |
211 \&           \*(AqRunas_Alias\*(Aq Runas_Alias (\*(Aq:\*(Aq Runas_Alias)* |
212 \&           \*(AqHost_Alias\*(Aq  Host_Alias (\*(Aq:\*(Aq Host_Alias)* |
213 \&           \*(AqCmnd_Alias\*(Aq  Cmnd_Alias (\*(Aq:\*(Aq Cmnd_Alias)*
214 \&
215 \& User_Alias ::= NAME \*(Aq=\*(Aq User_List
216 \&
217 \& Runas_Alias ::= NAME \*(Aq=\*(Aq Runas_List
218 \&
219 \& Host_Alias ::= NAME \*(Aq=\*(Aq Host_List
220 \&
221 \& Cmnd_Alias ::= NAME \*(Aq=\*(Aq Cmnd_List
222 \&
223 \& NAME ::= [A\-Z]([A\-Z][0\-9]_)*
224 .Ve
225 .PP
226 Each \fIalias\fR definition is of the form
227 .PP
228 .Vb 1
229 \& Alias_Type NAME = item1, item2, ...
230 .Ve
231 .PP
232 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,
233 or \f(CW\*(C`Cmnd_Alias\*(C'\fR.  A \f(CW\*(C`NAME\*(C'\fR is a string of uppercase letters, numbers,
234 and underscore characters ('_').  A \f(CW\*(C`NAME\*(C'\fR \fBmust\fR start with an
235 uppercase letter.  It is possible to put several alias definitions
236 of the same type on a single line, joined by a colon (':').  E.g.,
237 .PP
238 .Vb 1
239 \& Alias_Type NAME = item1, item2, item3 : NAME = item4, item5
240 .Ve
241 .PP
242 The definitions of what constitutes a valid \fIalias\fR member follow.
243 .PP
244 .Vb 2
245 \& User_List ::= User |
246 \&               User \*(Aq,\*(Aq User_List
247 \&
248 \& User ::= \*(Aq!\*(Aq* user name |
249 \&          \*(Aq!\*(Aq* #uid |
250 \&          \*(Aq!\*(Aq* %group |
251 \&          \*(Aq!\*(Aq* %#gid |
252 \&          \*(Aq!\*(Aq* +netgroup |
253 \&          \*(Aq!\*(Aq* %:nonunix_group |
254 \&          \*(Aq!\*(Aq* %:#nonunix_gid |
255 \&          \*(Aq!\*(Aq* User_Alias
256 .Ve
257 .PP
258 A \f(CW\*(C`User_List\*(C'\fR is made up of one or more user names, user ids
259 (prefixed with '#'), system group names and ids (prefixed with '%'
260 and '%#' respectively), netgroups (prefixed with '+'), non-Unix
261 group names and IDs (prefixed with '%:' and '%:#' respectively) and
262 \&\f(CW\*(C`User_Alias\*(C'\fRes.  Each list item may be prefixed with zero or more
263 \&'!' operators.  An odd number of '!' operators negate the value of
264 the item; an even number just cancel each other out.
265 .PP
266 A \f(CW\*(C`user name\*(C'\fR, \f(CW\*(C`uid\*(C'\fR, \f(CW\*(C`group\*(C'\fR, \f(CW\*(C`gid\*(C'\fR, \f(CW\*(C`netgroup\*(C'\fR, \f(CW\*(C`nonunix_group\*(C'\fR
267 or \f(CW\*(C`nonunix_gid\*(C'\fR may be enclosed in double quotes to avoid the
268 need for escaping special characters.  Alternately, special characters
269 may be specified in escaped hex mode, e.g. \ex20 for space.  When
270 using double quotes, any prefix characters must be included inside
271 the quotes.
272 .PP
273 The \f(CW\*(C`nonunix_group\*(C'\fR and \f(CW\*(C`nonunix_gid\*(C'\fR syntax depends on the
274 underlying implementation.  For instance, the \s-1QAS\s0 \s-1AD\s0 backend supports
275 the following formats:
276 .IP "\(bu" 4
277 Group in the same domain: \*(L"Group Name\*(R"
278 .IP "\(bu" 4
279 Group in any domain: \*(L"Group Name@FULLY.QUALIFIED.DOMAIN\*(R"
280 .IP "\(bu" 4
281 Group \s-1SID:\s0 \*(L"S\-1\-2\-34\-5678901234\-5678901234\-5678901234\-567\*(R"
282 .PP
283 Note that quotes around group names are optional.  Unquoted strings
284 must use a backslash (\e) to escape spaces and special characters.
285 See \*(L"Other special characters and reserved words\*(R" for a list of
286 characters that need to be escaped.
287 .PP
288 .Vb 2
289 \& Runas_List ::= Runas_Member |
290 \&                Runas_Member \*(Aq,\*(Aq Runas_List
291 \&
292 \& Runas_Member ::= \*(Aq!\*(Aq* user name |
293 \&                  \*(Aq!\*(Aq* #uid |
294 \&                  \*(Aq!\*(Aq* %group |
295 \&                  \*(Aq!\*(Aq* %#gid |
296 \&                  \*(Aq!\*(Aq* %:nonunix_group |
297 \&                  \*(Aq!\*(Aq* %:#nonunix_gid |
298 \&                  \*(Aq!\*(Aq* +netgroup |
299 \&                  \*(Aq!\*(Aq* Runas_Alias
300 .Ve
301 .PP
302 A \f(CW\*(C`Runas_List\*(C'\fR is similar to a \f(CW\*(C`User_List\*(C'\fR except that instead
303 of \f(CW\*(C`User_Alias\*(C'\fRes it can contain \f(CW\*(C`Runas_Alias\*(C'\fRes.  Note that
304 user names and groups are matched as strings.  In other words, two
305 users (groups) with the same uid (gid) are considered to be distinct.
306 If you wish to match all user names with the same uid (e.g.\ root
307 and toor), you can use a uid instead (#0 in the example given).
308 .PP
309 .Vb 2
310 \& Host_List ::= Host |
311 \&               Host \*(Aq,\*(Aq Host_List
312 \&
313 \& Host ::= \*(Aq!\*(Aq* host name |
314 \&          \*(Aq!\*(Aq* ip_addr |
315 \&          \*(Aq!\*(Aq* network(/netmask)? |
316 \&          \*(Aq!\*(Aq* +netgroup |
317 \&          \*(Aq!\*(Aq* Host_Alias
318 .Ve
319 .PP
320 A \f(CW\*(C`Host_List\*(C'\fR is made up of one or more host names, \s-1IP\s0 addresses,
321 network numbers, netgroups (prefixed with '+') and other aliases.
322 Again, the value of an item may be negated with the '!' operator.
323 If you do not specify a netmask along with the network number,
324 \&\fBsudo\fR will query each of the local host's network interfaces and,
325 if the network number corresponds to one of the hosts's network
326 interfaces, the corresponding netmask will be used.  The netmask
327 may be specified either in standard \s-1IP\s0 address notation
328 (e.g.\ 255.255.255.0 or ffff:ffff:ffff:ffff::),
329 or \s-1CIDR\s0 notation (number of bits, e.g.\ 24 or 64).  A host name may
330 include shell-style wildcards (see the Wildcards section below),
331 but unless the \f(CW\*(C`host name\*(C'\fR command on your machine returns the fully
332 qualified host name, you'll need to use the \fIfqdn\fR option for
333 wildcards to be useful.  Note \fBsudo\fR only inspects actual network
334 interfaces; this means that \s-1IP\s0 address 127.0.0.1 (localhost) will
335 never match.  Also, the host name \*(L"localhost\*(R" will only match if
336 that is the actual host name, which is usually only the case for
337 non-networked systems.
338 .PP
339 .Vb 2
340 \& Cmnd_List ::= Cmnd |
341 \&               Cmnd \*(Aq,\*(Aq Cmnd_List
342 \&
343 \& commandname ::= file name |
344 \&                 file name args |
345 \&                 file name \*(Aq""\*(Aq
346 \&
347 \& Cmnd ::= \*(Aq!\*(Aq* commandname |
348 \&          \*(Aq!\*(Aq* directory |
349 \&          \*(Aq!\*(Aq* "sudoedit" |
350 \&          \*(Aq!\*(Aq* Cmnd_Alias
351 .Ve
352 .PP
353 A \f(CW\*(C`Cmnd_List\*(C'\fR is a list of one or more commandnames, directories, and other
354 aliases.  A commandname is a fully qualified file name which may include
355 shell-style wildcards (see the Wildcards section below).  A simple
356 file name allows the user to run the command with any arguments he/she
357 wishes.  However, you may also specify command line arguments (including
358 wildcards).  Alternately, you can specify \f(CW""\fR to indicate that the command
359 may only be run \fBwithout\fR command line arguments.  A directory is a
360 fully qualified path name ending in a '/'.  When you specify a directory
361 in a \f(CW\*(C`Cmnd_List\*(C'\fR, the user will be able to run any file within that directory
362 (but not in any subdirectories therein).
363 .PP
364 If a \f(CW\*(C`Cmnd\*(C'\fR has associated command line arguments, then the arguments
365 in the \f(CW\*(C`Cmnd\*(C'\fR must match exactly those given by the user on the command line
366 (or match the wildcards if there are any).  Note that the following
367 characters must be escaped with a '\e' if they are used in command
368 arguments: ',', ':', '=', '\e'.  The special command \f(CW"sudoedit"\fR
369 is used to permit a user to run \fBsudo\fR with the \fB\-e\fR option (or
370 as \fBsudoedit\fR).  It may take command line arguments just as
371 a normal command does.
372 .SS "Defaults"
373 .IX Subsection "Defaults"
374 Certain configuration options may be changed from their default
375 values at runtime via one or more \f(CW\*(C`Default_Entry\*(C'\fR lines.  These
376 may affect all users on any host, all users on a specific host, a
377 specific user, a specific command, or commands being run as a specific user.
378 Note that per-command entries may not include command line arguments.
379 If you need to specify arguments, define a \f(CW\*(C`Cmnd_Alias\*(C'\fR and reference
380 that instead.
381 .PP
382 .Vb 5
383 \& Default_Type ::= \*(AqDefaults\*(Aq |
384 \&                  \*(AqDefaults\*(Aq \*(Aq@\*(Aq Host_List |
385 \&                  \*(AqDefaults\*(Aq \*(Aq:\*(Aq User_List |
386 \&                  \*(AqDefaults\*(Aq \*(Aq!\*(Aq Cmnd_List |
387 \&                  \*(AqDefaults\*(Aq \*(Aq>\*(Aq Runas_List
388 \&
389 \& Default_Entry ::= Default_Type Parameter_List
390 \&
391 \& Parameter_List ::= Parameter |
392 \&                    Parameter \*(Aq,\*(Aq Parameter_List
393 \&
394 \& Parameter ::= Parameter \*(Aq=\*(Aq Value |
395 \&               Parameter \*(Aq+=\*(Aq Value |
396 \&               Parameter \*(Aq\-=\*(Aq Value |
397 \&               \*(Aq!\*(Aq* Parameter
398 .Ve
399 .PP
400 Parameters may be \fBflags\fR, \fBinteger\fR values, \fBstrings\fR, or \fBlists\fR.
401 Flags are implicitly boolean and can be turned off via the '!'
402 operator.  Some integer, string and list parameters may also be
403 used in a boolean context to disable them.  Values may be enclosed
404 in double quotes (\f(CW\*(C`"\*(C'\fR) when they contain multiple words.  Special
405 characters may be escaped with a backslash (\f(CW\*(C`\e\*(C'\fR).
406 .PP
407 Lists have two additional assignment operators, \f(CW\*(C`+=\*(C'\fR and \f(CW\*(C`\-=\*(C'\fR.
408 These operators are used to add to and delete from a list respectively.
409 It is not an error to use the \f(CW\*(C`\-=\*(C'\fR operator to remove an element
410 that does not exist in a list.
411 .PP
412 Defaults entries are parsed in the following order: generic, host
413 and user Defaults first, then runas Defaults and finally command
414 defaults.
415 .PP
416 See \*(L"\s-1SUDOERS\s0 \s-1OPTIONS\s0\*(R" for a list of supported Defaults parameters.
417 .SS "User Specification"
418 .IX Subsection "User Specification"
419 .Vb 2
420 \& User_Spec ::= User_List Host_List \*(Aq=\*(Aq Cmnd_Spec_List \e
421 \&               (\*(Aq:\*(Aq Host_List \*(Aq=\*(Aq Cmnd_Spec_List)*
422 \&
423 \& Cmnd_Spec_List ::= Cmnd_Spec |
424 \&                    Cmnd_Spec \*(Aq,\*(Aq Cmnd_Spec_List
425 \&
426 .ie \n(SL \& Cmnd_Spec ::= Runas_Spec? SELinux_Spec? Tag_Spec* Cmnd
427 .el \& Cmnd_Spec ::= Runas_Spec? Tag_Spec* Cmnd
428 \&
429 \& Runas_Spec ::= \*(Aq(\*(Aq Runas_List? (\*(Aq:\*(Aq Runas_List)? \*(Aq)\*(Aq
430 \&
431 .if \n(SL \{\
432 \& SELinux_Spec ::= (\*(AqROLE=role\*(Aq | \*(AqTYPE=type\*(Aq)
433 \&
434 \}
435 \& Tag_Spec ::= (\*(AqNOPASSWD:\*(Aq | \*(AqPASSWD:\*(Aq | \*(AqNOEXEC:\*(Aq | \*(AqEXEC:\*(Aq |
436 \&               \*(AqSETENV:\*(Aq | \*(AqNOSETENV:\*(Aq | \*(AqLOG_INPUT:\*(Aq | \*(AqNOLOG_INPUT:\*(Aq |
437 \&               \*(AqLOG_OUTPUT:\*(Aq | \*(AqNOLOG_OUTPUT:\*(Aq)
438 .Ve
439 .PP
440 A \fBuser specification\fR determines which commands a user may run
441 (and as what user) on specified hosts.  By default, commands are
442 run as \fBroot\fR, but this can be changed on a per-command basis.
443 .PP
444 The basic structure of a user specification is `who where = (as_whom)
445 what'.  Let's break that down into its constituent parts:
446 .SS "Runas_Spec"
447 .IX Subsection "Runas_Spec"
448 A \f(CW\*(C`Runas_Spec\*(C'\fR determines the user and/or the group that a command
449 may be run as.  A fully-specified \f(CW\*(C`Runas_Spec\*(C'\fR consists of two
450 \&\f(CW\*(C`Runas_List\*(C'\fRs (as defined above) separated by a colon (':') and
451 enclosed in a set of parentheses.  The first \f(CW\*(C`Runas_List\*(C'\fR indicates
452 which users the command may be run as via \fBsudo\fR's \fB\-u\fR option.
453 The second defines a list of groups that can be specified via
454 \&\fBsudo\fR's \fB\-g\fR option.  If both \f(CW\*(C`Runas_List\*(C'\fRs are specified, the
455 command may be run with any combination of users and groups listed
456 in their respective \f(CW\*(C`Runas_List\*(C'\fRs.  If only the first is specified,
457 the command may be run as any user in the list but no \fB\-g\fR option
458 may be specified.  If the first \f(CW\*(C`Runas_List\*(C'\fR is empty but the
459 second is specified, the command may be run as the invoking user
460 with the group set to any listed in the \f(CW\*(C`Runas_List\*(C'\fR.  If no
461 \&\f(CW\*(C`Runas_Spec\*(C'\fR is specified the command may be run as \fBroot\fR and
462 no group may be specified.
463 .PP
464 A \f(CW\*(C`Runas_Spec\*(C'\fR sets the default for the commands that follow it.
465 What this means is that for the entry:
466 .PP
467 .Vb 1
468 \& dgb    boulder = (operator) /bin/ls, /bin/kill, /usr/bin/lprm
469 .Ve
470 .PP
471 The user \fBdgb\fR may run \fI/bin/ls\fR, \fI/bin/kill\fR, and
472 \&\fI/usr/bin/lprm\fR \*(-- but only as \fBoperator\fR.  E.g.,
473 .PP
474 .Vb 1
475 \& $ sudo \-u operator /bin/ls
476 .Ve
477 .PP
478 It is also possible to override a \f(CW\*(C`Runas_Spec\*(C'\fR later on in an
479 entry.  If we modify the entry like so:
480 .PP
481 .Vb 1
482 \& dgb    boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm
483 .Ve
484 .PP
485 Then user \fBdgb\fR is now allowed to run \fI/bin/ls\fR as \fBoperator\fR,
486 but  \fI/bin/kill\fR and \fI/usr/bin/lprm\fR as \fBroot\fR.
487 .PP
488 We can extend this to allow \fBdgb\fR to run \f(CW\*(C`/bin/ls\*(C'\fR with either
489 the user or group set to \fBoperator\fR:
490 .PP
491 .Vb 2
492 \& dgb    boulder = (operator : operator) /bin/ls, (root) /bin/kill, \e
493 \&        /usr/bin/lprm
494 .Ve
495 .PP
496 Note that while the group portion of the \f(CW\*(C`Runas_Spec\*(C'\fR permits the
497 user to run as command with that group, it does not force the user
498 to do so.  If no group is specified on the command line, the command
499 will run with the group listed in the target user's password database
500 entry.  The following would all be permitted by the sudoers entry above:
501 .PP
502 .Vb 3
503 \& $ sudo \-u operator /bin/ls
504 \& $ sudo \-u operator \-g operator /bin/ls
505 \& $ sudo \-g operator /bin/ls
506 .Ve
507 .PP
508 In the following example, user \fBtcm\fR may run commands that access
509 a modem device file with the dialer group.
510 .PP
511 .Vb 2
512 \& tcm    boulder = (:dialer) /usr/bin/tip, /usr/bin/cu, \e
513 \&        /usr/local/bin/minicom
514 .Ve
515 .PP
516 Note that in this example only the group will be set, the command
517 still runs as user \fBtcm\fR.  E.g.
518 .PP
519 .Vb 1
520 \& $ sudo \-g dialer /usr/bin/cu
521 .Ve
522 .PP
523 Multiple users and groups may be present in a \f(CW\*(C`Runas_Spec\*(C'\fR, in
524 which case the user may select any combination of users and groups
525 via the \fB\-u\fR and \fB\-g\fR options.  In this example:
526 .PP
527 .Vb 1
528 \& alan   ALL = (root, bin : operator, system) ALL
529 .Ve
530 .PP
531 user \fBalan\fR may run any command as either user root or bin,
532 optionally setting the group to operator or system.
533 .if \n(SL \{\
534 .SS "SELinux_Spec"
535 .IX Subsection "SELinux_Spec"
536 On systems with SELinux support, \fIsudoers\fR entries may optionally have
537 an SELinux role and/or type associated with a command.  If a role or
538 type is specified with the command it will override any default values
539 specified in \fIsudoers\fR.  A role or type specified on the command line,
540 however, will supercede the values in \fIsudoers\fR.
541 \}
542 .SS "Tag_Spec"
543 .IX Subsection "Tag_Spec"
544 A command may have zero or more tags associated with it.  There are
545 eight possible tag values, \f(CW\*(C`NOPASSWD\*(C'\fR, \f(CW\*(C`PASSWD\*(C'\fR, \f(CW\*(C`NOEXEC\*(C'\fR,
546 \&\f(CW\*(C`EXEC\*(C'\fR, \f(CW\*(C`SETENV\*(C'\fR, \f(CW\*(C`NOSETENV\*(C'\fR, \f(CW\*(C`LOG_INPUT\*(C'\fR, \f(CW\*(C`NOLOG_INPUT\*(C'\fR,
547 \&\f(CW\*(C`LOG_OUTPUT\*(C'\fR and \f(CW\*(C`NOLOG_OUTPUT\*(C'\fR.  Once a tag is set on a \f(CW\*(C`Cmnd\*(C'\fR,
548 subsequent \f(CW\*(C`Cmnd\*(C'\fRs in the \f(CW\*(C`Cmnd_Spec_List\*(C'\fR, inherit the tag unless
549 it is overridden by the opposite tag (i.e.: \f(CW\*(C`PASSWD\*(C'\fR overrides
550 \&\f(CW\*(C`NOPASSWD\*(C'\fR and \f(CW\*(C`NOEXEC\*(C'\fR overrides \f(CW\*(C`EXEC\*(C'\fR).
551 .PP
552 \fI\s-1NOPASSWD\s0 and \s-1PASSWD\s0\fR
553 .IX Subsection "NOPASSWD and PASSWD"
554 .PP
555 By default, \fBsudo\fR requires that a user authenticate him or herself
556 before running a command.  This behavior can be modified via the
557 \&\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
558 a default for the commands that follow it in the \f(CW\*(C`Cmnd_Spec_List\*(C'\fR.
559 Conversely, the \f(CW\*(C`PASSWD\*(C'\fR tag can be used to reverse things.
560 For example:
561 .PP
562 .Vb 1
563 \& ray    rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
564 .Ve
565 .PP
566 would allow the user \fBray\fR to run \fI/bin/kill\fR, \fI/bin/ls\fR, and
567 \&\fI/usr/bin/lprm\fR as \fBroot\fR on the machine rushmore without
568 authenticating himself.  If we only want \fBray\fR to be able to
569 run \fI/bin/kill\fR without a password the entry would be:
570 .PP
571 .Vb 1
572 \& ray    rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
573 .Ve
574 .PP
575 Note, however, that the \f(CW\*(C`PASSWD\*(C'\fR tag has no effect on users who are
576 in the group specified by the \fIexempt_group\fR option.
577 .PP
578 By default, if the \f(CW\*(C`NOPASSWD\*(C'\fR tag is applied to any of the entries
579 for a user on the current host, he or she will be able to run
580 \&\f(CW\*(C`sudo \-l\*(C'\fR without a password.  Additionally, a user may only run
581 \&\f(CW\*(C`sudo \-v\*(C'\fR without a password if the \f(CW\*(C`NOPASSWD\*(C'\fR tag is present
582 for all a user's entries that pertain to the current host.
583 This behavior may be overridden via the verifypw and listpw options.
584 .PP
585 \fI\s-1NOEXEC\s0 and \s-1EXEC\s0\fR
586 .IX Subsection "NOEXEC and EXEC"
587 .PP
588 If \fBsudo\fR has been compiled with \fInoexec\fR support and the underlying
589 operating system supports it, the \f(CW\*(C`NOEXEC\*(C'\fR tag can be used to prevent
590 a dynamically-linked executable from running further commands itself.
591 .PP
592 In the following example, user \fBaaron\fR may run \fI/usr/bin/more\fR
593 and \fI/usr/bin/vi\fR but shell escapes will be disabled.
594 .PP
595 .Vb 1
596 \& aaron  shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
597 .Ve
598 .PP
599 See the \*(L"\s-1PREVENTING\s0 \s-1SHELL\s0 \s-1ESCAPES\s0\*(R" section below for more details
600 on how \f(CW\*(C`NOEXEC\*(C'\fR works and whether or not it will work on your system.
601 .PP
602 \fI\s-1SETENV\s0 and \s-1NOSETENV\s0\fR
603 .IX Subsection "SETENV and NOSETENV"
604 .PP
605 These tags override the value of the \fIsetenv\fR option on a per-command
606 basis.  Note that if \f(CW\*(C`SETENV\*(C'\fR has been set for a command, the user
607 may disable the \fIenv_reset\fR option from the command line via the
608 \&\fB\-E\fR option.  Additionally, environment variables set on the command
609 line are not subject to the restrictions imposed by \fIenv_check\fR,
610 \&\fIenv_delete\fR, or \fIenv_keep\fR.  As such, only trusted users should
611 be allowed to set variables in this manner.  If the command matched
612 is \fB\s-1ALL\s0\fR, the \f(CW\*(C`SETENV\*(C'\fR tag is implied for that command; this
613 default may be overridden by use of the \f(CW\*(C`NOSETENV\*(C'\fR tag.
614 .PP
615 \fI\s-1LOG_INPUT\s0 and \s-1NOLOG_INPUT\s0\fR
616 .IX Subsection "LOG_INPUT and NOLOG_INPUT"
617 .PP
618 These tags override the value of the \fIlog_input\fR option on a
619 per-command basis.  For more information, see the description of
620 \&\fIlog_input\fR in the \*(L"\s-1SUDOERS\s0 \s-1OPTIONS\s0\*(R" section below.
621 .PP
622 \fI\s-1LOG_OUTPUT\s0 and \s-1NOLOG_OUTPUT\s0\fR
623 .IX Subsection "LOG_OUTPUT and NOLOG_OUTPUT"
624 .PP
625 These tags override the value of the \fIlog_output\fR option on a
626 per-command basis.  For more information, see the description of
627 \&\fIlog_output\fR in the \*(L"\s-1SUDOERS\s0 \s-1OPTIONS\s0\*(R" section below.
628 .SS "Wildcards"
629 .IX Subsection "Wildcards"
630 \&\fBsudo\fR allows shell-style \fIwildcards\fR (aka meta or glob characters)
631 to be used in host names, path names and command line arguments in
632 the \fIsudoers\fR file.  Wildcard matching is done via the \fB\s-1POSIX\s0\fR
633 \&\fIglob\fR\|(3) and \fIfnmatch\fR\|(3) routines.  Note that these are \fInot\fR
634 regular expressions.
635 .ie n .IP "\*(C`*\*(C'" 8
636 .el .IP "\f(CW\*(C`*\*(C'\fR" 8
637 .IX Item "*"
638 Matches any set of zero or more characters.
639 .ie n .IP "\*(C`?\*(C'" 8
640 .el .IP "\f(CW\*(C`?\*(C'\fR" 8
641 .IX Item "?"
642 Matches any single character.
643 .ie n .IP "\*(C`[...]\*(C'" 8
644 .el .IP "\f(CW\*(C`[...]\*(C'\fR" 8
645 .IX Item "[...]"
646 Matches any character in the specified range.
647 .ie n .IP "\*(C`[!...]\*(C'" 8
648 .el .IP "\f(CW\*(C`[!...]\*(C'\fR" 8
649 .IX Item "[!...]"
650 Matches any character \fBnot\fR in the specified range.
651 .ie n .IP "\*(C`\ex\*(C'" 8
652 .el .IP "\f(CW\*(C`\ex\*(C'\fR" 8
653 .IX Item "x"
654 For any character \*(L"x\*(R", evaluates to \*(L"x\*(R".  This is used to
655 escape special characters such as: \*(L"*\*(R", \*(L"?\*(R", \*(L"[\*(R", and \*(L"}\*(R".
656 .PP
657 \&\s-1POSIX\s0 character classes may also be used if your system's \fIglob\fR\|(3)
658 and \fIfnmatch\fR\|(3) functions support them.  However, because the
659 \&\f(CW\*(Aq:\*(Aq\fR character has special meaning in \fIsudoers\fR, it must be
660 escaped.  For example:
661 .PP
662 .Vb 1
663 \&    /bin/ls [[\e:alpha\e:]]*
664 .Ve
665 .PP
666 Would match any file name beginning with a letter.
667 .PP
668 Note that a forward slash ('/') will \fBnot\fR be matched by
669 wildcards used in the path name.  When matching the command
670 line arguments, however, a slash \fBdoes\fR get matched by
671 wildcards.  This is to make a path like:
672 .PP
673 .Vb 1
674 \&    /usr/bin/*
675 .Ve
676 .PP
677 match \fI/usr/bin/who\fR but not \fI/usr/bin/X11/xterm\fR.
678 .SS "Exceptions to wildcard rules"
679 .IX Subsection "Exceptions to wildcard rules"
680 The following exceptions apply to the above rules:
681 .ie n .IP """""" 8
682 .el .IP "\f(CW``''\fR" 8
683 .IX Item """"""
684 If the empty string \f(CW""\fR is the only command line argument in the
685 \&\fIsudoers\fR entry it means that command is not allowed to be run
686 with \fBany\fR arguments.
687 .SS "Including other files from within sudoers"
688 .IX Subsection "Including other files from within sudoers"
689 It is possible to include other \fIsudoers\fR files from within the
690 \&\fIsudoers\fR file currently being parsed using the \f(CW\*(C`#include\*(C'\fR and
691 \&\f(CW\*(C`#includedir\*(C'\fR directives.
692 .PP
693 This can be used, for example, to keep a site-wide \fIsudoers\fR file
694 in addition to a local, per-machine file.  For the sake of this
695 example the site-wide \fIsudoers\fR will be \fI/etc/sudoers\fR and the
696 per-machine one will be \fI/etc/sudoers.local\fR.  To include
697 \&\fI/etc/sudoers.local\fR from within \fI/etc/sudoers\fR we would use the
698 following line in \fI/etc/sudoers\fR:
699 .Sp
700 .RS 4
701 \&\f(CW\*(C`#include /etc/sudoers.local\*(C'\fR
702 .RE
703 .PP
704 When \fBsudo\fR reaches this line it will suspend processing of the
705 current file (\fI/etc/sudoers\fR) and switch to \fI/etc/sudoers.local\fR.
706 Upon reaching the end of \fI/etc/sudoers.local\fR, the rest of
707 \&\fI/etc/sudoers\fR will be processed.  Files that are included may
708 themselves include other files.  A hard limit of 128 nested include
709 files is enforced to prevent include file loops.
710 .PP
711 The file name may include the \f(CW%h\fR escape, signifying the short form
712 of the host name.  I.e., if the machine's host name is \*(L"xerxes\*(R", then
713 .PP
714 \&\f(CW\*(C`#include /etc/sudoers.%h\*(C'\fR
715 .PP
716 will cause \fBsudo\fR to include the file \fI/etc/sudoers.xerxes\fR.
717 .PP
718 The \f(CW\*(C`#includedir\*(C'\fR directive can be used to create a \fIsudo.d\fR
719 directory that the system package manager can drop \fIsudoers\fR rules
720 into as part of package installation.  For example, given:
721 .PP
722 \&\f(CW\*(C`#includedir /etc/sudoers.d\*(C'\fR
723 .PP
724 \&\fBsudo\fR will read each file in \fI/etc/sudoers.d\fR, skipping file
725 names that end in \f(CW\*(C`~\*(C'\fR or contain a \f(CW\*(C`.\*(C'\fR character to avoid causing
726 problems with package manager or editor temporary/backup files.
727 Files are parsed in sorted lexical order.  That is,
728 \&\fI/etc/sudoers.d/01_first\fR will be parsed before
729 \&\fI/etc/sudoers.d/10_second\fR.  Be aware that because the sorting is
730 lexical, not numeric, \fI/etc/sudoers.d/1_whoops\fR would be loaded
731 \&\fBafter\fR \fI/etc/sudoers.d/10_second\fR.  Using a consistent number
732 of leading zeroes in the file names can be used to avoid such
733 problems.
734 .PP
735 Note that unlike files included via \f(CW\*(C`#include\*(C'\fR, \fBvisudo\fR will not
736 edit the files in a \f(CW\*(C`#includedir\*(C'\fR directory unless one of them
737 contains a syntax error.  It is still possible to run \fBvisudo\fR
738 with the \f(CW\*(C`\-f\*(C'\fR flag to edit the files directly.
739 .SS "Other special characters and reserved words"
740 .IX Subsection "Other special characters and reserved words"
741 The pound sign ('#') is used to indicate a comment (unless it is
742 part of a #include directive or unless it occurs in the context of
743 a user name and is followed by one or more digits, in which case
744 it is treated as a uid).  Both the comment character and any text
745 after it, up to the end of the line, are ignored.
746 .PP
747 The reserved word \fB\s-1ALL\s0\fR is a built-in \fIalias\fR that always causes
748 a match to succeed.  It can be used wherever one might otherwise
749 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.
750 You should not try to define your own \fIalias\fR called \fB\s-1ALL\s0\fR as the
751 built-in alias will be used in preference to your own.  Please note
752 that using \fB\s-1ALL\s0\fR can be dangerous since in a command context, it
753 allows the user to run \fBany\fR command on the system.
754 .PP
755 An exclamation point ('!') can be used as a logical \fInot\fR operator
756 both in an \fIalias\fR and in front of a \f(CW\*(C`Cmnd\*(C'\fR.  This allows one to
757 exclude certain values.  Note, however, that using a \f(CW\*(C`!\*(C'\fR in
758 conjunction with the built-in \f(CW\*(C`ALL\*(C'\fR alias to allow a user to
759 run \*(L"all but a few\*(R" commands rarely works as intended (see \s-1SECURITY\s0
760 \&\s-1NOTES\s0 below).
761 .PP
762 Long lines can be continued with a backslash ('\e') as the last
763 character on the line.
764 .PP
765 Whitespace between elements in a list as well as special syntactic
766 characters in a \fIUser Specification\fR ('=', ':', '(', ')') is optional.
767 .PP
768 The following characters must be escaped with a backslash ('\e') when
769 used as part of a word (e.g.\ a user name or host name):
770 \&'!', '=', ':', ',', '(', ')', '\e'.
771 .SH "SUDOERS OPTIONS"
772 .IX Header "SUDOERS OPTIONS"
773 \&\fBsudo\fR's behavior can be modified by \f(CW\*(C`Default_Entry\*(C'\fR lines, as
774 explained earlier.  A list of all supported Defaults parameters,
775 grouped by type, are listed below.
776 .PP
777 \&\fBBoolean Flags\fR:
778 .IP "always_set_home" 16
779 .IX Item "always_set_home"
780 If enabled, \fBsudo\fR will set the \f(CW\*(C`HOME\*(C'\fR environment variable to the
781 home directory of the target user (which is root unless the \fB\-u\fR
782 option is used).  This effectively means that the \fB\-H\fR option is
783 always implied.  Note that \f(CW\*(C`HOME\*(C'\fR is already set when the the
784 \&\fIenv_reset\fR option is enabled, so \fIalways_set_home\fR is only
785 effective for configurations where either \fIenv_reset\fR is disabled
786 or \f(CW\*(C`HOME\*(C'\fR is present in the \fIenv_keep\fR list.
787 This flag is \fIoff\fR by default.
788 .IP "authenticate" 16
789 .IX Item "authenticate"
790 If set, users must authenticate themselves via a password (or other
791 means of authentication) before they may run commands.  This default
792 may be overridden via the \f(CW\*(C`PASSWD\*(C'\fR and \f(CW\*(C`NOPASSWD\*(C'\fR tags.
793 This flag is \fIon\fR by default.
794 .IP "closefrom_override" 16
795 .IX Item "closefrom_override"
796 If set, the user may use \fBsudo\fR's \fB\-C\fR option which
797 overrides the default starting point at which \fBsudo\fR begins
798 closing open file descriptors.  This flag is \fIoff\fR by default.
799 .IP "compress_io" 16
800 .IX Item "compress_io"
801 If set, and \fBsudo\fR is configured to log a command's input or output,
802 the I/O logs will be compressed using \fBzlib\fR.  This flag is \fIon\fR
803 by default when \fBsudo\fR is compiled with \fBzlib\fR support.
804 .IP "env_editor" 16
805 .IX Item "env_editor"
806 If set, \fBvisudo\fR will use the value of the \s-1EDITOR\s0 or \s-1VISUAL\s0
807 environment variables before falling back on the default editor list.
808 Note that this may create a security hole as it allows the user to
809 run any arbitrary command as root without logging.  A safer alternative
810 is to place a colon-separated list of editors in the \f(CW\*(C`editor\*(C'\fR
811 variable.  \fBvisudo\fR will then only use the \s-1EDITOR\s0 or \s-1VISUAL\s0 if
812 they match a value specified in \f(CW\*(C`editor\*(C'\fR.  This flag is \fI@env_editor@\fR by
813 default.
814 .IP "env_reset" 16
815 .IX Item "env_reset"
816 If set, \fBsudo\fR will reset the environment to only contain the
817 \&\s-1LOGNAME\s0, \s-1MAIL\s0, \s-1SHELL\s0, \s-1USER\s0, \s-1USERNAME\s0 and the \f(CW\*(C`SUDO_*\*(C'\fR variables.  Any
818 variables in the caller's environment that match the \f(CW\*(C`env_keep\*(C'\fR
819 and \f(CW\*(C`env_check\*(C'\fR lists are then added.  The default contents of the
820 \&\f(CW\*(C`env_keep\*(C'\fR and \f(CW\*(C`env_check\*(C'\fR lists are displayed when \fBsudo\fR is
821 run by root with the \fI\-V\fR option.  If the \fIsecure_path\fR option
822 is set, its value will be used for the \f(CW\*(C`PATH\*(C'\fR environment variable.
823 This flag is \fI@env_reset@\fR by default.
824 .IP "fast_glob" 16
825 .IX Item "fast_glob"
826 Normally, \fBsudo\fR uses the \fIglob\fR\|(3) function to do shell-style
827 globbing when matching path names.  However, since it accesses the
828 file system, \fIglob\fR\|(3) can take a long time to complete for some
829 patterns, especially when the pattern references a network file
830 system that is mounted on demand (automounted).  The \fIfast_glob\fR
831 option causes \fBsudo\fR to use the \fIfnmatch\fR\|(3) function, which does
832 not access the file system to do its matching.  The disadvantage
833 of \fIfast_glob\fR is that it is unable to match relative path names
834 such as \fI./ls\fR or \fI../bin/ls\fR.  This has security implications
835 when path names that include globbing characters are used with the
836 negation operator, \f(CW\*(Aq!\*(Aq\fR, as such rules can be trivially bypassed.
837 As such, this option should not be used when \fIsudoers\fR contains rules 
838 that contain negated path names which include globbing characters.
839 This flag is \fIoff\fR by default.
840 .IP "fqdn" 16
841 .IX Item "fqdn"
842 Set this flag if you want to put fully qualified host names in the
843 \&\fIsudoers\fR file.  I.e., instead of myhost you would use myhost.mydomain.edu.
844 You may still use the short form if you wish (and even mix the two).
845 Beware that turning on \fIfqdn\fR requires \fBsudo\fR to make \s-1DNS\s0 lookups
846 which may make \fBsudo\fR unusable if \s-1DNS\s0 stops working (for example
847 if the machine is not plugged into the network).  Also note that
848 you must use the host's official name as \s-1DNS\s0 knows it.  That is,
849 you may not use a host alias (\f(CW\*(C`CNAME\*(C'\fR entry) due to performance
850 issues and the fact that there is no way to get all aliases from
851 \&\s-1DNS\s0.  If your machine's host name (as returned by the \f(CW\*(C`hostname\*(C'\fR
852 command) is already fully qualified you shouldn't need to set
853 \&\fIfqdn\fR.  This flag is \fI@fqdn@\fR by default.
854 .IP "ignore_dot" 16
855 .IX Item "ignore_dot"
856 If set, \fBsudo\fR will ignore '.' or '' (current dir) in the \f(CW\*(C`PATH\*(C'\fR
857 environment variable; the \f(CW\*(C`PATH\*(C'\fR itself is not modified.  This
858 flag is \fI@ignore_dot@\fR by default.
859 .IP "ignore_local_sudoers" 16
860 .IX Item "ignore_local_sudoers"
861 If set via \s-1LDAP\s0, parsing of \fI@sysconfdir@/sudoers\fR will be skipped.
862 This is intended for Enterprises that wish to prevent the usage of local
863 sudoers files so that only \s-1LDAP\s0 is used.  This thwarts the efforts of
864 rogue operators who would attempt to add roles to \fI@sysconfdir@/sudoers\fR.
865 When this option is present, \fI@sysconfdir@/sudoers\fR does not even need to
866 exist. Since this option tells \fBsudo\fR how to behave when no specific \s-1LDAP\s0
867 entries have been matched, this sudoOption is only meaningful for the
868 \&\f(CW\*(C`cn=defaults\*(C'\fR section.  This flag is \fIoff\fR by default.
869 .IP "insults" 16
870 .IX Item "insults"
871 If set, \fBsudo\fR will insult users when they enter an incorrect
872 password.  This flag is \fI@insults@\fR by default.
873 .IP "log_host" 16
874 .IX Item "log_host"
875 If set, the host name will be logged in the (non-syslog) \fBsudo\fR log file.
876 This flag is \fIoff\fR by default.
877 .IP "log_input" 16
878 .IX Item "log_input"
879 If set, \fBsudo\fR will run the command in a \fIpseudo tty\fR and log all
880 user input.
881 If the standard input is not connected to the user's tty, due to
882 I/O redirection or because the command is part of a pipeline, that
883 input is also captured and stored in a separate log file.
884 .Sp
885 Input is logged to the directory specified by the \fIiolog_dir\fR
886 option (\fI@iolog_dir@\fR by default) using a unique session \s-1ID\s0 that
887 is included in the normal \fBsudo\fR log line, prefixed with \fITSID=\fR.
888 .Sp
889 Note that user input may contain sensitive information such as
890 passwords (even if they are not echoed to the screen), which will
891 be stored in the log file unencrypted.  In most cases, logging the
892 command output via \fIlog_output\fR is all that is required.
893 .IP "log_output" 16
894 .IX Item "log_output"
895 If set, \fBsudo\fR will run the command in a \fIpseudo tty\fR and log all
896 output that is sent to the screen, similar to the \fIscript\fR\|(1) command.
897 If the standard output or standard error is not connected to the
898 user's tty, due to I/O redirection or because the command is part
899 of a pipeline, that output is also captured and stored in separate
900 log files.
901 .Sp
902 Output is logged to the directory specified by the \fIiolog_dir\fR
903 option (\fI@iolog_dir@\fR by default) using a unique session \s-1ID\s0 that
904 is included in the normal \fBsudo\fR log line, prefixed with \fITSID=\fR.
905 .Sp
906 Output logs may be viewed with the \fIsudoreplay\fR\|(@mansectsu@) utility, which
907 can also be used to list or search the available logs.
908 .IP "log_year" 16
909 .IX Item "log_year"
910 If set, the four-digit year will be logged in the (non-syslog) \fBsudo\fR log file.
911 This flag is \fIoff\fR by default.
912 .IP "long_otp_prompt" 16
913 .IX Item "long_otp_prompt"
914 When validating with a One Time Password (\s-1OPT\s0) scheme such as
915 \&\fBS/Key\fR or \fB\s-1OPIE\s0\fR, a two-line prompt is used to make it easier
916 to cut and paste the challenge to a local window.  It's not as
917 pretty as the default but some people find it more convenient.  This
918 flag is \fI@long_otp_prompt@\fR by default.
919 .IP "mail_always" 16
920 .IX Item "mail_always"
921 Send mail to the \fImailto\fR user every time a users runs \fBsudo\fR.
922 This flag is \fIoff\fR by default.
923 .IP "mail_badpass" 16
924 .IX Item "mail_badpass"
925 Send mail to the \fImailto\fR user if the user running \fBsudo\fR does not
926 enter the correct password.  This flag is \fIoff\fR by default.
927 .IP "mail_no_host" 16
928 .IX Item "mail_no_host"
929 If set, mail will be sent to the \fImailto\fR user if the invoking
930 user exists in the \fIsudoers\fR file, but is not allowed to run
931 commands on the current host.  This flag is \fI@mail_no_host@\fR by default.
932 .IP "mail_no_perms" 16
933 .IX Item "mail_no_perms"
934 If set, mail will be sent to the \fImailto\fR user if the invoking
935 user is allowed to use \fBsudo\fR but the command they are trying is not
936 listed in their \fIsudoers\fR file entry or is explicitly denied.
937 This flag is \fI@mail_no_perms@\fR by default.
938 .IP "mail_no_user" 16
939 .IX Item "mail_no_user"
940 If set, mail will be sent to the \fImailto\fR user if the invoking
941 user is not in the \fIsudoers\fR file.  This flag is \fI@mail_no_user@\fR
942 by default.
943 .IP "noexec" 16
944 .IX Item "noexec"
945 If set, all commands run via \fBsudo\fR will behave as if the \f(CW\*(C`NOEXEC\*(C'\fR
946 tag has been set, unless overridden by a \f(CW\*(C`EXEC\*(C'\fR tag.  See the
947 description of \fI\s-1NOEXEC\s0 and \s-1EXEC\s0\fR below as well as the \*(L"\s-1PREVENTING\s0 \s-1SHELL\s0
948 \&\s-1ESCAPES\s0\*(R" section at the end of this manual.  This flag is \fIoff\fR by default.
949 .IP "path_info" 16
950 .IX Item "path_info"
951 Normally, \fBsudo\fR will tell the user when a command could not be
952 found in their \f(CW\*(C`PATH\*(C'\fR environment variable.  Some sites may wish
953 to disable this as it could be used to gather information on the
954 location of executables that the normal user does not have access
955 to.  The disadvantage is that if the executable is simply not in
956 the user's \f(CW\*(C`PATH\*(C'\fR, \fBsudo\fR will tell the user that they are not
957 allowed to run it, which can be confusing.  This flag is \fI@path_info@\fR
958 by default.
959 .IP "passprompt_override" 16
960 .IX Item "passprompt_override"
961 The password prompt specified by \fIpassprompt\fR will normally only
962 be used if the password prompt provided by systems such as \s-1PAM\s0 matches
963 the string \*(L"Password:\*(R".  If \fIpassprompt_override\fR is set, \fIpassprompt\fR
964 will always be used.  This flag is \fIoff\fR by default.
965 .IP "preserve_groups" 16
966 .IX Item "preserve_groups"
967 By default, \fBsudo\fR will initialize the group vector to the list of
968 groups the target user is in.  When \fIpreserve_groups\fR is set, the
969 user's existing group vector is left unaltered.  The real and
970 effective group IDs, however, are still set to match the target
971 user.  This flag is \fIoff\fR by default.
972 .IP "pwfeedback" 16
973 .IX Item "pwfeedback"
974 By default, \fBsudo\fR reads the password like most other Unix programs,
975 by turning off echo until the user hits the return (or enter) key.
976 Some users become confused by this as it appears to them that \fBsudo\fR
977 has hung at this point.  When \fIpwfeedback\fR is set, \fBsudo\fR will
978 provide visual feedback when the user presses a key.  Note that
979 this does have a security impact as an onlooker may be able to
980 determine the length of the password being entered.
981 This flag is \fIoff\fR by default.
982 .IP "requiretty" 16
983 .IX Item "requiretty"
984 If set, \fBsudo\fR will only run when the user is logged in to a real
985 tty.  When this flag is set, \fBsudo\fR can only be run from a login
986 session and not via other means such as \fIcron\fR\|(@mansectsu@) or cgi-bin scripts.
987 This flag is \fIoff\fR by default.
988 .IP "root_sudo" 16
989 .IX Item "root_sudo"
990 If set, root is allowed to run \fBsudo\fR too.  Disabling this prevents users
991 from \*(L"chaining\*(R" \fBsudo\fR commands to get a root shell by doing something
992 like \f(CW"sudo sudo /bin/sh"\fR.  Note, however, that turning off \fIroot_sudo\fR
993 will also prevent root from running \fBsudoedit\fR.
994 Disabling \fIroot_sudo\fR provides no real additional security; it
995 exists purely for historical reasons.
996 This flag is \fI@root_sudo@\fR by default.
997 .IP "rootpw" 16
998 .IX Item "rootpw"
999 If set, \fBsudo\fR will prompt for the root password instead of the password
1000 of the invoking user.  This flag is \fIoff\fR by default.
1001 .IP "runaspw" 16
1002 .IX Item "runaspw"
1003 If set, \fBsudo\fR will prompt for the password of the user defined by the
1004 \&\fIrunas_default\fR option (defaults to \f(CW\*(C`@runas_default@\*(C'\fR) instead of the
1005 password of the invoking user.  This flag is \fIoff\fR by default.
1006 .IP "set_home" 16
1007 .IX Item "set_home"
1008 If enabled and \fBsudo\fR is invoked with the \fB\-s\fR option the \f(CW\*(C`HOME\*(C'\fR
1009 environment variable will be set to the home directory of the target
1010 user (which is root unless the \fB\-u\fR option is used).  This effectively
1011 makes the \fB\-s\fR option imply \fB\-H\fR.  Note that \f(CW\*(C`HOME\*(C'\fR is already
1012 set when the the \fIenv_reset\fR option is enabled, so \fIset_home\fR is
1013 only effective for configurations where either \fIenv_reset\fR is disabled
1014 or \f(CW\*(C`HOME\*(C'\fR is present in the \fIenv_keep\fR list.
1015 This flag is \fIoff\fR by default.
1016 .IP "set_logname" 16
1017 .IX Item "set_logname"
1018 Normally, \fBsudo\fR will set the \f(CW\*(C`LOGNAME\*(C'\fR, \f(CW\*(C`USER\*(C'\fR and \f(CW\*(C`USERNAME\*(C'\fR
1019 environment variables to the name of the target user (usually root
1020 unless the \fB\-u\fR option is given).  However, since some programs
1021 (including the \s-1RCS\s0 revision control system) use \f(CW\*(C`LOGNAME\*(C'\fR to
1022 determine the real identity of the user, it may be desirable to
1023 change this behavior.  This can be done by negating the set_logname
1024 option.  Note that if the \fIenv_reset\fR option has not been disabled,
1025 entries in the \fIenv_keep\fR list will override the value of
1026 \&\fIset_logname\fR.  This flag is \fIon\fR by default.
1027 .IP "setenv" 16
1028 .IX Item "setenv"
1029 Allow the user to disable the \fIenv_reset\fR option from the command
1030 line.  Additionally, environment variables set via the command line
1031 are not subject to the restrictions imposed by \fIenv_check\fR,
1032 \&\fIenv_delete\fR, or \fIenv_keep\fR.  As such, only trusted users should
1033 be allowed to set variables in this manner.  This flag is \fIoff\fR
1034 by default.
1035 .IP "shell_noargs" 16
1036 .IX Item "shell_noargs"
1037 If set and \fBsudo\fR is invoked with no arguments it acts as if the
1038 \&\fB\-s\fR option had been given.  That is, it runs a shell as root (the
1039 shell is determined by the \f(CW\*(C`SHELL\*(C'\fR environment variable if it is
1040 set, falling back on the shell listed in the invoking user's
1041 /etc/passwd entry if not).  This flag is \fIoff\fR by default.
1042 .IP "stay_setuid" 16
1043 .IX Item "stay_setuid"
1044 Normally, when \fBsudo\fR executes a command the real and effective
1045 UIDs are set to the target user (root by default).  This option
1046 changes that behavior such that the real \s-1UID\s0 is left as the invoking
1047 user's \s-1UID\s0.  In other words, this makes \fBsudo\fR act as a setuid
1048 wrapper.  This can be useful on systems that disable some potentially
1049 dangerous functionality when a program is run setuid.  This option
1050 is only effective on systems with either the \fIsetreuid()\fR or \fIsetresuid()\fR
1051 function.  This flag is \fIoff\fR by default.
1052 .IP "targetpw" 16
1053 .IX Item "targetpw"
1054 If set, \fBsudo\fR will prompt for the password of the user specified
1055 by the \fB\-u\fR option (defaults to \f(CW\*(C`root\*(C'\fR) instead of the password
1056 of the invoking user.  In addition, the timestamp file name will
1057 include the target user's name.  Note that this flag precludes the
1058 use of a uid not listed in the passwd database as an argument to
1059 the \fB\-u\fR option.  This flag is \fIoff\fR by default.
1060 .IP "tty_tickets" 16
1061 .IX Item "tty_tickets"
1062 If set, users must authenticate on a per-tty basis.  With this flag
1063 enabled, \fBsudo\fR will use a file named for the tty the user is
1064 logged in on in the user's time stamp directory.  If disabled, the
1065 time stamp of the directory is used instead.  This flag is
1066 \&\fI@tty_tickets@\fR by default.
1067 .IP "umask_override" 16
1068 .IX Item "umask_override"
1069 If set, \fBsudo\fR will set the umask as specified by \fIsudoers\fR without
1070 modification.  This makes it possible to specify a more permissive
1071 umask in \fIsudoers\fR than the user's own umask and matches historical
1072 behavior.  If \fIumask_override\fR is not set, \fBsudo\fR will set the
1073 umask to be the union of the user's umask and what is specified in
1074 \&\fIsudoers\fR.  This flag is \fI@umask_override@\fR by default.
1075 .if \n(LC \{\
1076 .IP "use_loginclass" 16
1077 .IX Item "use_loginclass"
1078 If set, \fBsudo\fR will apply the defaults specified for the target user's
1079 login class if one exists.  Only available if \fBsudo\fR is configured with
1080 the \-\-with\-logincap option.  This flag is \fIoff\fR by default.
1081 \}
1082 .IP "use_pty" 16
1083 .IX Item "use_pty"
1084 If set, \fBsudo\fR will run the command in a pseudo-pty even if no I/O
1085 logging is being gone.  A malicious program run under \fBsudo\fR could
1086 conceivably fork a background process that retains to the user's
1087 terminal device after the main program has finished executing.  Use
1088 of this option will make that impossible.
1089 .IP "visiblepw" 16
1090 .IX Item "visiblepw"
1091 By default, \fBsudo\fR will refuse to run if the user must enter a
1092 password but it is not possible to disable echo on the terminal.
1093 If the \fIvisiblepw\fR flag is set, \fBsudo\fR will prompt for a password
1094 even when it would be visible on the screen.  This makes it possible
1095 to run things like \f(CW"rsh somehost sudo ls"\fR since \fIrsh\fR\|(1) does
1096 not allocate a tty.  This flag is \fIoff\fR by default.
1097 .PP
1098 \&\fBIntegers\fR:
1099 .IP "closefrom" 16
1100 .IX Item "closefrom"
1101 Before it executes a command, \fBsudo\fR will close all open file
1102 descriptors other than standard input, standard output and standard
1103 error (ie: file descriptors 0\-2).  The \fIclosefrom\fR option can be used
1104 to specify a different file descriptor at which to start closing.
1105 The default is \f(CW3\fR.
1106 .IP "passwd_tries" 16
1107 .IX Item "passwd_tries"
1108 The number of tries a user gets to enter his/her password before
1109 \&\fBsudo\fR logs the failure and exits.  The default is \f(CW\*(C`@passwd_tries@\*(C'\fR.
1110 .PP
1111 \&\fBIntegers that can be used in a boolean context\fR:
1112 .IP "loglinelen" 16
1113 .IX Item "loglinelen"
1114 Number of characters per line for the file log.  This value is used
1115 to decide when to wrap lines for nicer log files.  This has no
1116 effect on the syslog log file, only the file log.  The default is
1117 \&\f(CW\*(C`@loglen@\*(C'\fR (use 0 or negate the option to disable word wrap).
1118 .IP "passwd_timeout" 16
1119 .IX Item "passwd_timeout"
1120 Number of minutes before the \fBsudo\fR password prompt times out, or
1121 \&\f(CW0\fR for no timeout.  The timeout may include a fractional component
1122 if minute granularity is insufficient, for example \f(CW2.5\fR.  The
1123 default is \f(CW\*(C`@password_timeout@\*(C'\fR.
1124 .IP "timestamp_timeout" 16
1125 .IX Item "timestamp_timeout"
1126 Number of minutes that can elapse before \fBsudo\fR will ask for a
1127 passwd again.  The timeout may include a fractional component if
1128 minute granularity is insufficient, for example \f(CW2.5\fR.  The default
1129 is \f(CW\*(C`@timeout@\*(C'\fR.  Set this to \f(CW0\fR to always prompt for a password.
1130 If set to a value less than \f(CW0\fR the user's timestamp will never
1131 expire.  This can be used to allow users to create or delete their
1132 own timestamps via \f(CW\*(C`sudo \-v\*(C'\fR and \f(CW\*(C`sudo \-k\*(C'\fR respectively.
1133 .IP "umask" 16
1134 .IX Item "umask"
1135 Umask to use when running the command.  Negate this option or set
1136 it to 0777 to preserve the user's umask.  The actual umask that is
1137 used will be the union of the user's umask and the value of the
1138 \&\fIumask\fR option, which defaults to \f(CW\*(C`@sudo_umask@\*(C'\fR.  This guarantees
1139 that \fBsudo\fR never lowers the umask when running a command.  Note
1140 on systems that use \s-1PAM\s0, the default \s-1PAM\s0 configuration may specify
1141 its own umask which will override the value set in \fIsudoers\fR.
1142 .PP
1143 \&\fBStrings\fR:
1144 .IP "badpass_message" 16
1145 .IX Item "badpass_message"
1146 Message that is displayed if a user enters an incorrect password.
1147 The default is \f(CW\*(C`@badpass_message@\*(C'\fR unless insults are enabled.
1148 .IP "editor" 16
1149 .IX Item "editor"
1150 A colon (':') separated list of editors allowed to be used with
1151 \&\fBvisudo\fR.  \fBvisudo\fR will choose the editor that matches the user's
1152 \&\s-1EDITOR\s0 environment variable if possible, or the first editor in the
1153 list that exists and is executable.  The default is \f(CW"@editor@"\fR.
1154 .IP "iolog_dir" 16
1155 .IX Item "iolog_dir"
1156 The directory in which to store input/output logs when the \fIlog_input\fR
1157 or \fIlog_output\fR options are enabled or when the \f(CW\*(C`LOG_INPUT\*(C'\fR or
1158 \&\f(CW\*(C`LOG_OUTPUT\*(C'\fR tags are present for a command.
1159 The default is \f(CW"@iolog_dir@"\fR.
1160 .IP "mailsub" 16
1161 .IX Item "mailsub"
1162 Subject of the mail sent to the \fImailto\fR user. The escape \f(CW%h\fR
1163 will expand to the host name of the machine.
1164 Default is \f(CW\*(C`@mailsub@\*(C'\fR.
1165 .IP "noexec_file" 16
1166 .IX Item "noexec_file"
1167 Path to a shared library containing dummy versions of the \fIexecv()\fR,
1168 \&\fIexecve()\fR and \fIfexecve()\fR library functions that just return an error.
1169 This is used to implement the \fInoexec\fR functionality on systems that
1170 support \f(CW\*(C`LD_PRELOAD\*(C'\fR or its equivalent.  Defaults to \fI@noexec_file@\fR.
1171 .IP "passprompt" 16
1172 .IX Item "passprompt"
1173 The default prompt to use when asking for a password; can be overridden
1174 via the \fB\-p\fR option or the \f(CW\*(C`SUDO_PROMPT\*(C'\fR environment variable.
1175 The following percent (`\f(CW\*(C`%\*(C'\fR') escapes are supported:
1176 .RS 16
1177 .ie n .IP "%H" 4
1178 .el .IP "\f(CW%H\fR" 4
1179 .IX Item "%H"
1180 expanded to the local host name including the domain name
1181 (on if the machine's host name is fully qualified or the \fIfqdn\fR
1182 option is set)
1183 .ie n .IP "%h" 4
1184 .el .IP "\f(CW%h\fR" 4
1185 .IX Item "%h"
1186 expanded to the local host name without the domain name
1187 .ie n .IP "%p" 4
1188 .el .IP "\f(CW%p\fR" 4
1189 .IX Item "%p"
1190 expanded to the user whose password is being asked for (respects the 
1191 \&\fIrootpw\fR, \fItargetpw\fR and \fIrunaspw\fR flags in \fIsudoers\fR)
1192 .ie n .IP "%U" 4
1193 .el .IP "\f(CW%U\fR" 4
1194 .IX Item "%U"
1195 expanded to the login name of the user the command will
1196 be run as (defaults to root)
1197 .ie n .IP "%u" 4
1198 .el .IP "\f(CW%u\fR" 4
1199 .IX Item "%u"
1200 expanded to the invoking user's login name
1201 .ie n .IP "\*(C`%%\*(C'" 4
1202 .el .IP "\f(CW\*(C`%%\*(C'\fR" 4
1203 .IX Item "%%"
1204 two consecutive \f(CW\*(C`%\*(C'\fR characters are collapsed into a single \f(CW\*(C`%\*(C'\fR character
1205 .RE
1206 .RS 16
1207 .Sp
1208 The default value is \f(CW\*(C`@passprompt@\*(C'\fR.
1209 .RE
1210 .if \n(SL \{\
1211 .IP "role" 16
1212 .IX Item "role"
1213 The default SELinux role to use when constructing a new security
1214 context to run the command.  The default role may be overridden on
1215 a per-command basis in \fIsudoers\fR or via command line options.
1216 This option is only available whe \fBsudo\fR is built with SELinux support.
1217 \}
1218 .IP "runas_default" 16
1219 .IX Item "runas_default"
1220 The default user to run commands as if the \fB\-u\fR option is not specified
1221 on the command line.  This defaults to \f(CW\*(C`@runas_default@\*(C'\fR.
1222 Note that if \fIrunas_default\fR is set it \fBmust\fR occur before
1223 any \f(CW\*(C`Runas_Alias\*(C'\fR specifications.
1224 .IP "syslog_badpri" 16
1225 .IX Item "syslog_badpri"
1226 Syslog priority to use when user authenticates unsuccessfully.
1227 Defaults to \f(CW\*(C`@badpri@\*(C'\fR.
1228 .IP "syslog_goodpri" 16
1229 .IX Item "syslog_goodpri"
1230 Syslog priority to use when user authenticates successfully.
1231 Defaults to \f(CW\*(C`@goodpri@\*(C'\fR.
1232 .IP "sudoers_locale" 16
1233 .IX Item "sudoers_locale"
1234 Locale to use when parsing the sudoers file, logging commands, and
1235 sending email.  Note that changing the locale may affect how sudoers
1236 is interpreted.  Defaults to \f(CW"C"\fR.
1237 .IP "timestampdir" 16
1238 .IX Item "timestampdir"
1239 The directory in which \fBsudo\fR stores its timestamp files.
1240 The default is \fI@timedir@\fR.
1241 .IP "timestampowner" 16
1242 .IX Item "timestampowner"
1243 The owner of the timestamp directory and the timestamps stored therein.
1244 The default is \f(CW\*(C`root\*(C'\fR.
1245 .if \n(SL \{\
1246 .IP "type" 16
1247 .IX Item "type"
1248 The default SELinux type to use when constructing a new security
1249 context to run the command.  The default type may be overridden on
1250 a per-command basis in \fIsudoers\fR or via command line options.
1251 This option is only available whe \fBsudo\fR is built with SELinux support.
1252 \}
1253 .PP
1254 \&\fBStrings that can be used in a boolean context\fR:
1255 .IP "askpass" 12
1256 .IX Item "askpass"
1257 The \fIaskpass\fR option specifies the fully qualified path to a helper
1258 program used to read the user's password when no terminal is
1259 available.  This may be the case when \fBsudo\fR is executed from a
1260 graphical (as opposed to text-based) application.  The program
1261 specified by \fIaskpass\fR should display the argument passed to it
1262 as the prompt and write the user's password to the standard output.
1263 The value of \fIaskpass\fR may be overridden by the \f(CW\*(C`SUDO_ASKPASS\*(C'\fR
1264 environment variable.
1265 .IP "env_file" 12
1266 .IX Item "env_file"
1267 The \fIenv_file\fR options specifies the fully qualified path to a
1268 file containing variables to be set in the environment of the program
1269 being run.  Entries in this file should either be of the form
1270 \&\f(CW\*(C`VARIABLE=value\*(C'\fR or \f(CW\*(C`export VARIABLE=value\*(C'\fR.  The value may
1271 optionally be surrounded by single or double quotes.  Variables in
1272 this file are subject to other \fBsudo\fR environment settings such
1273 as \fIenv_keep\fR and \fIenv_check\fR.
1274 .IP "exempt_group" 12
1275 .IX Item "exempt_group"
1276 Users in this group are exempt from password and \s-1PATH\s0 requirements.
1277 This is not set by default.
1278 .IP "lecture" 12
1279 .IX Item "lecture"
1280 This option controls when a short lecture will be printed along with
1281 the password prompt.  It has the following possible values:
1282 .RS 12
1283 .IP "always" 8
1284 .IX Item "always"
1285 Always lecture the user.
1286 .IP "never" 8
1287 .IX Item "never"
1288 Never lecture the user.
1289 .IP "once" 8
1290 .IX Item "once"
1291 Only lecture the user the first time they run \fBsudo\fR.
1292 .RE
1293 .RS 12
1294 .Sp
1295 If no value is specified, a value of \fIonce\fR is implied.
1296 Negating the option results in a value of \fInever\fR being used.
1297 The default value is \fI@lecture@\fR.
1298 .RE
1299 .IP "lecture_file" 12
1300 .IX Item "lecture_file"
1301 Path to a file containing an alternate \fBsudo\fR lecture that will
1302 be used in place of the standard lecture if the named file exists.
1303 By default, \fBsudo\fR uses a built-in lecture.
1304 .IP "listpw" 12
1305 .IX Item "listpw"
1306 This option controls when a password will be required when a
1307 user runs \fBsudo\fR with the \fB\-l\fR option.  It has the following possible values:
1308 .RS 12
1309 .IP "all" 8
1310 .IX Item "all"
1311 All the user's \fIsudoers\fR entries for the current host must have
1312 the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
1313 .IP "always" 8
1314 .IX Item "always"
1315 The user must always enter a password to use the \fB\-l\fR option.
1316 .IP "any" 8
1317 .IX Item "any"
1318 At least one of the user's \fIsudoers\fR entries for the current host
1319 must have the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
1320 .IP "never" 8
1321 .IX Item "never"
1322 The user need never enter a password to use the \fB\-l\fR option.
1323 .RE
1324 .RS 12
1325 .Sp
1326 If no value is specified, a value of \fIany\fR is implied.
1327 Negating the option results in a value of \fInever\fR being used.
1328 The default value is \fIany\fR.
1329 .RE
1330 .IP "logfile" 12
1331 .IX Item "logfile"
1332 Path to the \fBsudo\fR log file (not the syslog log file).  Setting a path
1333 turns on logging to a file; negating this option turns it off.
1334 By default, \fBsudo\fR logs via syslog.
1335 .IP "mailerflags" 12
1336 .IX Item "mailerflags"
1337 Flags to use when invoking mailer. Defaults to \fB\-t\fR.
1338 .IP "mailerpath" 12
1339 .IX Item "mailerpath"
1340 Path to mail program used to send warning mail.
1341 Defaults to the path to sendmail found at configure time.
1342 .IP "mailfrom" 12
1343 .IX Item "mailfrom"
1344 Address to use for the \*(L"from\*(R" address when sending warning and error
1345 mail.  The address should be enclosed in double quotes (\f(CW\*(C`"\*(C'\fR) to
1346 protect against \fBsudo\fR interpreting the \f(CW\*(C`@\*(C'\fR sign.  Defaults to
1347 the name of the user running \fBsudo\fR.
1348 .IP "mailto" 12
1349 .IX Item "mailto"
1350 Address to send warning and error mail to.  The address should
1351 be enclosed in double quotes (\f(CW\*(C`"\*(C'\fR) to protect against \fBsudo\fR
1352 interpreting the \f(CW\*(C`@\*(C'\fR sign.  Defaults to \f(CW\*(C`@mailto@\*(C'\fR.
1353 .IP "secure_path" 12
1354 .IX Item "secure_path"
1355 Path used for every command run from \fBsudo\fR.  If you don't trust the
1356 people running \fBsudo\fR to have a sane \f(CW\*(C`PATH\*(C'\fR environment variable you may
1357 want to use this.  Another use is if you want to have the \*(L"root path\*(R"
1358 be separate from the \*(L"user path.\*(R"  Users in the group specified by the
1359 \&\fIexempt_group\fR option are not affected by \fIsecure_path\fR.
1360 This option is @secure_path@ by default.
1361 .IP "syslog" 12
1362 .IX Item "syslog"
1363 Syslog facility if syslog is being used for logging (negate to
1364 disable syslog logging).  Defaults to \f(CW\*(C`@logfac@\*(C'\fR.
1365 .IP "verifypw" 12
1366 .IX Item "verifypw"
1367 This option controls when a password will be required when a user runs
1368 \&\fBsudo\fR with the \fB\-v\fR option.  It has the following possible values:
1369 .RS 12
1370 .IP "all" 8
1371 .IX Item "all"
1372 All the user's \fIsudoers\fR entries for the current host must have
1373 the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
1374 .IP "always" 8
1375 .IX Item "always"
1376 The user must always enter a password to use the \fB\-v\fR option.
1377 .IP "any" 8
1378 .IX Item "any"
1379 At least one of the user's \fIsudoers\fR entries for the current host
1380 must have the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
1381 .IP "never" 8
1382 .IX Item "never"
1383 The user need never enter a password to use the \fB\-v\fR option.
1384 .RE
1385 .RS 12
1386 .Sp
1387 If no value is specified, a value of \fIall\fR is implied.
1388 Negating the option results in a value of \fInever\fR being used.
1389 The default value is \fIall\fR.
1390 .RE
1391 .PP
1392 \&\fBLists that can be used in a boolean context\fR:
1393 .IP "env_check" 16
1394 .IX Item "env_check"
1395 Environment variables to be removed from the user's environment if
1396 the variable's value contains \f(CW\*(C`%\*(C'\fR or \f(CW\*(C`/\*(C'\fR characters.  This can
1397 be used to guard against printf-style format vulnerabilities in
1398 poorly-written programs.  The argument may be a double-quoted,
1399 space-separated list or a single value without double-quotes.  The
1400 list can be replaced, added to, deleted from, or disabled by using
1401 the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and \f(CW\*(C`!\*(C'\fR operators respectively.  Regardless
1402 of whether the \f(CW\*(C`env_reset\*(C'\fR option is enabled or disabled, variables
1403 specified by \f(CW\*(C`env_check\*(C'\fR will be preserved in the environment if
1404 they pass the aforementioned check.  The default list of environment
1405 variables to check is displayed when \fBsudo\fR is run by root with
1406 the \fI\-V\fR option.
1407 .IP "env_delete" 16
1408 .IX Item "env_delete"
1409 Environment variables to be removed from the user's environment
1410 when the \fIenv_reset\fR option is not in effect.  The argument may
1411 be a double-quoted, space-separated list or a single value without
1412 double-quotes.  The list can be replaced, added to, deleted from,
1413 or disabled by using the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and \f(CW\*(C`!\*(C'\fR operators
1414 respectively.  The default list of environment variables to remove
1415 is displayed when \fBsudo\fR is run by root with the \fI\-V\fR option.
1416 Note that many operating systems will remove potentially dangerous
1417 variables from the environment of any setuid process (such as
1418 \&\fBsudo\fR).
1419 .IP "env_keep" 16
1420 .IX Item "env_keep"
1421 Environment variables to be preserved in the user's environment
1422 when the \fIenv_reset\fR option is in effect.  This allows fine-grained
1423 control over the environment \fBsudo\fR\-spawned processes will receive.
1424 The argument may be a double-quoted, space-separated list or a
1425 single value without double-quotes.  The list can be replaced, added
1426 to, deleted from, or disabled by using the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and
1427 \&\f(CW\*(C`!\*(C'\fR operators respectively.  The default list of variables to keep
1428 is displayed when \fBsudo\fR is run by root with the \fI\-V\fR option.
1429 .PP
1430 When logging via \fIsyslog\fR\|(3), \fBsudo\fR accepts the following values
1431 for the syslog facility (the value of the \fBsyslog\fR Parameter):
1432 \&\fBauthpriv\fR (if your \s-1OS\s0 supports it), \fBauth\fR, \fBdaemon\fR, \fBuser\fR,
1433 \&\fBlocal0\fR, \fBlocal1\fR, \fBlocal2\fR, \fBlocal3\fR, \fBlocal4\fR, \fBlocal5\fR,
1434 \&\fBlocal6\fR, and \fBlocal7\fR.  The following syslog priorities are
1435 supported: \fBalert\fR, \fBcrit\fR, \fBdebug\fR, \fBemerg\fR, \fBerr\fR, \fBinfo\fR,
1436 \&\fBnotice\fR, and \fBwarning\fR.
1437 .SH "FILES"
1438 .IX Header "FILES"
1439 .ie n .IP "\fI@sysconfdir@/sudoers\fR" 24
1440 .el .IP "\fI@sysconfdir@/sudoers\fR" 24
1441 .IX Item "@sysconfdir@/sudoers"
1442 List of who can run what
1443 .IP "\fI/etc/group\fR" 24
1444 .IX Item "/etc/group"
1445 Local groups file
1446 .IP "\fI/etc/netgroup\fR" 24
1447 .IX Item "/etc/netgroup"
1448 List of network groups
1449 .ie n .IP "\fI@iolog_dir@\fR" 24
1450 .el .IP "\fI@iolog_dir@\fR" 24
1451 .IX Item "@iolog_dir@"
1452 I/O log files
1453 .SH "EXAMPLES"
1454 .IX Header "EXAMPLES"
1455 Below are example \fIsudoers\fR entries.  Admittedly, some of
1456 these are a bit contrived.  First, we allow a few environment
1457 variables to pass and then define our \fIaliases\fR:
1458 .PP
1459 .Vb 4
1460 \& # Run X applications through sudo; HOME is used to find the
1461 \& # .Xauthority file.  Note that other programs use HOME to find
1462 \& # configuration files and this may lead to privilege escalation!
1463 \& Defaults env_keep += "DISPLAY HOME"
1464 \&
1465 \& # User alias specification
1466 \& User_Alias     FULLTIMERS = millert, mikef, dowdy
1467 \& User_Alias     PARTTIMERS = bostley, jwfox, crawl
1468 \& User_Alias     WEBMASTERS = will, wendy, wim
1469 \&
1470 \& # Runas alias specification
1471 \& Runas_Alias    OP = root, operator
1472 \& Runas_Alias    DB = oracle, sybase
1473 \& Runas_Alias    ADMINGRP = adm, oper
1474 \&
1475 \& # Host alias specification
1476 \& Host_Alias     SPARC = bigtime, eclipse, moet, anchor :\e
1477 \&                SGI = grolsch, dandelion, black :\e
1478 \&                ALPHA = widget, thalamus, foobar :\e
1479 \&                HPPA = boa, nag, python
1480 \& Host_Alias     CUNETS = 128.138.0.0/255.255.0.0
1481 \& Host_Alias     CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
1482 \& Host_Alias     SERVERS = master, mail, www, ns
1483 \& Host_Alias     CDROM = orion, perseus, hercules
1484 \&
1485 \& # Cmnd alias specification
1486 \& Cmnd_Alias     DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\e
1487 \&                        /usr/sbin/restore, /usr/sbin/rrestore
1488 \& Cmnd_Alias     KILL = /usr/bin/kill
1489 \& Cmnd_Alias     PRINTING = /usr/sbin/lpc, /usr/bin/lprm
1490 \& Cmnd_Alias     SHUTDOWN = /usr/sbin/shutdown
1491 \& Cmnd_Alias     HALT = /usr/sbin/halt
1492 \& Cmnd_Alias     REBOOT = /usr/sbin/reboot
1493 \& Cmnd_Alias     SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh, \e
1494 \&                         /usr/local/bin/tcsh, /usr/bin/rsh, \e
1495 \&                         /usr/local/bin/zsh
1496 \& Cmnd_Alias     SU = /usr/bin/su
1497 \& Cmnd_Alias     PAGERS = /usr/bin/more, /usr/bin/pg, /usr/bin/less
1498 .Ve
1499 .PP
1500 Here we override some of the compiled in default values.  We want
1501 \&\fBsudo\fR to log via \fIsyslog\fR\|(3) using the \fIauth\fR facility in all
1502 cases.  We don't want to subject the full time staff to the \fBsudo\fR
1503 lecture, user \fBmillert\fR need not give a password, and we don't
1504 want to reset the \f(CW\*(C`LOGNAME\*(C'\fR, \f(CW\*(C`USER\*(C'\fR or \f(CW\*(C`USERNAME\*(C'\fR environment
1505 variables when running commands as root.  Additionally, on the
1506 machines in the \fI\s-1SERVERS\s0\fR \f(CW\*(C`Host_Alias\*(C'\fR, we keep an additional
1507 local log file and make sure we log the year in each log line since
1508 the log entries will be kept around for several years.  Lastly, we
1509 disable shell escapes for the commands in the \s-1PAGERS\s0 \f(CW\*(C`Cmnd_Alias\*(C'\fR
1510 (\fI/usr/bin/more\fR, \fI/usr/bin/pg\fR and \fI/usr/bin/less\fR).
1511 .PP
1512 .Vb 7
1513 \& # Override built\-in defaults
1514 \& Defaults               syslog=auth
1515 \& Defaults>root          !set_logname
1516 \& Defaults:FULLTIMERS    !lecture
1517 \& Defaults:millert       !authenticate
1518 \& Defaults@SERVERS       log_year, logfile=/var/log/sudo.log
1519 \& Defaults!PAGERS        noexec
1520 .Ve
1521 .PP
1522 The \fIUser specification\fR is the part that actually determines who may
1523 run what.
1524 .PP
1525 .Vb 2
1526 \& root           ALL = (ALL) ALL
1527 \& %wheel         ALL = (ALL) ALL
1528 .Ve
1529 .PP
1530 We let \fBroot\fR and any user in group \fBwheel\fR run any command on any
1531 host as any user.
1532 .PP
1533 .Vb 1
1534 \& FULLTIMERS     ALL = NOPASSWD: ALL
1535 .Ve
1536 .PP
1537 Full time sysadmins (\fBmillert\fR, \fBmikef\fR, and \fBdowdy\fR) may run any
1538 command on any host without authenticating themselves.
1539 .PP
1540 .Vb 1
1541 \& PARTTIMERS     ALL = ALL
1542 .Ve
1543 .PP
1544 Part time sysadmins (\fBbostley\fR, \fBjwfox\fR, and \fBcrawl\fR) may run any
1545 command on any host but they must authenticate themselves first
1546 (since the entry lacks the \f(CW\*(C`NOPASSWD\*(C'\fR tag).
1547 .PP
1548 .Vb 1
1549 \& jack           CSNETS = ALL
1550 .Ve
1551 .PP
1552 The user \fBjack\fR may run any command on the machines in the \fI\s-1CSNETS\s0\fR alias
1553 (the networks \f(CW128.138.243.0\fR, \f(CW128.138.204.0\fR, and \f(CW128.138.242.0\fR).
1554 Of those networks, only \f(CW128.138.204.0\fR has an explicit netmask (in
1555 \&\s-1CIDR\s0 notation) indicating it is a class C network.  For the other
1556 networks in \fI\s-1CSNETS\s0\fR, the local machine's netmask will be used
1557 during matching.
1558 .PP
1559 .Vb 1
1560 \& lisa           CUNETS = ALL
1561 .Ve
1562 .PP
1563 The user \fBlisa\fR may run any command on any host in the \fI\s-1CUNETS\s0\fR alias
1564 (the class B network \f(CW128.138.0.0\fR).
1565 .PP
1566 .Vb 2
1567 \& operator       ALL = DUMPS, KILL, SHUTDOWN, HALT, REBOOT, PRINTING,\e
1568 \&                sudoedit /etc/printcap, /usr/oper/bin/
1569 .Ve
1570 .PP
1571 The \fBoperator\fR user may run commands limited to simple maintenance.
1572 Here, those are commands related to backups, killing processes, the
1573 printing system, shutting down the system, and any commands in the
1574 directory \fI/usr/oper/bin/\fR.
1575 .PP
1576 .Vb 1
1577 \& joe            ALL = /usr/bin/su operator
1578 .Ve
1579 .PP
1580 The user \fBjoe\fR may only \fIsu\fR\|(1) to operator.
1581 .PP
1582 .Vb 1
1583 \& pete           HPPA = /usr/bin/passwd [A\-Za\-z]*, !/usr/bin/passwd root
1584 \&
1585 \& %opers         ALL = (: ADMINGRP) /usr/sbin/
1586 .Ve
1587 .PP
1588 Users in the \fBopers\fR group may run commands in \fI/usr/sbin/\fR as themselves
1589 with any group in the \fI\s-1ADMINGRP\s0\fR \f(CW\*(C`Runas_Alias\*(C'\fR (the \fBadm\fR and \fBoper\fR
1590 groups).
1591 .PP
1592 The user \fBpete\fR is allowed to change anyone's password except for
1593 root on the \fI\s-1HPPA\s0\fR machines.  Note that this assumes \fIpasswd\fR\|(1)
1594 does not take multiple user names on the command line.
1595 .PP
1596 .Vb 1
1597 \& bob            SPARC = (OP) ALL : SGI = (OP) ALL
1598 .Ve
1599 .PP
1600 The user \fBbob\fR may run anything on the \fI\s-1SPARC\s0\fR and \fI\s-1SGI\s0\fR machines
1601 as any user listed in the \fI\s-1OP\s0\fR \f(CW\*(C`Runas_Alias\*(C'\fR (\fBroot\fR and \fBoperator\fR).
1602 .PP
1603 .Vb 1
1604 \& jim            +biglab = ALL
1605 .Ve
1606 .PP
1607 The user \fBjim\fR may run any command on machines in the \fIbiglab\fR netgroup.
1608 \&\fBsudo\fR knows that \*(L"biglab\*(R" is a netgroup due to the '+' prefix.
1609 .PP
1610 .Vb 1
1611 \& +secretaries   ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser
1612 .Ve
1613 .PP
1614 Users in the \fBsecretaries\fR netgroup need to help manage the printers
1615 as well as add and remove users, so they are allowed to run those
1616 commands on all machines.
1617 .PP
1618 .Vb 1
1619 \& fred           ALL = (DB) NOPASSWD: ALL
1620 .Ve
1621 .PP
1622 The user \fBfred\fR can run commands as any user in the \fI\s-1DB\s0\fR \f(CW\*(C`Runas_Alias\*(C'\fR
1623 (\fBoracle\fR or \fBsybase\fR) without giving a password.
1624 .PP
1625 .Vb 1
1626 \& john           ALPHA = /usr/bin/su [!\-]*, !/usr/bin/su *root*
1627 .Ve
1628 .PP
1629 On the \fI\s-1ALPHA\s0\fR machines, user \fBjohn\fR may su to anyone except root
1630 but he is not allowed to specify any options to the \fIsu\fR\|(1) command.
1631 .PP
1632 .Vb 1
1633 \& jen            ALL, !SERVERS = ALL
1634 .Ve
1635 .PP
1636 The user \fBjen\fR may run any command on any machine except for those
1637 in the \fI\s-1SERVERS\s0\fR \f(CW\*(C`Host_Alias\*(C'\fR (master, mail, www and ns).
1638 .PP
1639 .Vb 1
1640 \& jill           SERVERS = /usr/bin/, !SU, !SHELLS
1641 .Ve
1642 .PP
1643 For any machine in the \fI\s-1SERVERS\s0\fR \f(CW\*(C`Host_Alias\*(C'\fR, \fBjill\fR may run
1644 any commands in the directory \fI/usr/bin/\fR except for those commands
1645 belonging to the \fI\s-1SU\s0\fR and \fI\s-1SHELLS\s0\fR \f(CW\*(C`Cmnd_Aliases\*(C'\fR.
1646 .PP
1647 .Vb 1
1648 \& steve          CSNETS = (operator) /usr/local/op_commands/
1649 .Ve
1650 .PP
1651 The user \fBsteve\fR may run any command in the directory /usr/local/op_commands/
1652 but only as user operator.
1653 .PP
1654 .Vb 1
1655 \& matt           valkyrie = KILL
1656 .Ve
1657 .PP
1658 On his personal workstation, valkyrie, \fBmatt\fR needs to be able to
1659 kill hung processes.
1660 .PP
1661 .Vb 1
1662 \& WEBMASTERS     www = (www) ALL, (root) /usr/bin/su www
1663 .Ve
1664 .PP
1665 On the host www, any user in the \fI\s-1WEBMASTERS\s0\fR \f(CW\*(C`User_Alias\*(C'\fR (will,
1666 wendy, and wim), may run any command as user www (which owns the
1667 web pages) or simply \fIsu\fR\|(1) to www.
1668 .PP
1669 .Vb 2
1670 \& ALL            CDROM = NOPASSWD: /sbin/umount /CDROM,\e
1671 \&                /sbin/mount \-o nosuid\e,nodev /dev/cd0a /CDROM
1672 .Ve
1673 .PP
1674 Any user may mount or unmount a CD-ROM on the machines in the \s-1CDROM\s0
1675 \&\f(CW\*(C`Host_Alias\*(C'\fR (orion, perseus, hercules) without entering a password.
1676 This is a bit tedious for users to type, so it is a prime candidate
1677 for encapsulating in a shell script.
1678 .SH "SECURITY NOTES"
1679 .IX Header "SECURITY NOTES"
1680 It is generally not effective to \*(L"subtract\*(R" commands from \f(CW\*(C`ALL\*(C'\fR
1681 using the '!' operator.  A user can trivially circumvent this
1682 by copying the desired command to a different name and then
1683 executing that.  For example:
1684 .PP
1685 .Vb 1
1686 \&    bill        ALL = ALL, !SU, !SHELLS
1687 .Ve
1688 .PP
1689 Doesn't really prevent \fBbill\fR from running the commands listed in
1690 \&\fI\s-1SU\s0\fR or \fI\s-1SHELLS\s0\fR since he can simply copy those commands to a
1691 different name, or use a shell escape from an editor or other
1692 program.  Therefore, these kind of restrictions should be considered
1693 advisory at best (and reinforced by policy).
1694 .PP
1695 Furthermore, if the \fIfast_glob\fR option is in use, it is not possible
1696 to reliably negate commands where the path name includes globbing
1697 (aka wildcard) characters.  This is because the C library's
1698 \&\fIfnmatch\fR\|(3) function cannot resolve relative paths.  While this
1699 is typically only an inconvenience for rules that grant privileges,
1700 it can result in a security issue for rules that subtract or revoke
1701 privileges.
1702 .PP
1703 For example, given the following \fIsudoers\fR entry:
1704 .PP
1705 .Vb 2
1706 \& john   ALL = /usr/bin/passwd [a\-zA\-Z0\-9]*, /usr/bin/chsh [a\-zA\-Z0\-9]*,
1707 \&      /usr/bin/chfn [a\-zA\-Z0\-9]*, !/usr/bin/* root
1708 .Ve
1709 .PP
1710 User \fBjohn\fR can still run \f(CW\*(C`/usr/bin/passwd root\*(C'\fR if \fIfast_glob\fR is
1711 enabled by changing to \fI/usr/bin\fR and running \f(CW\*(C`./passwd root\*(C'\fR instead.
1712 .SH "PREVENTING SHELL ESCAPES"
1713 .IX Header "PREVENTING SHELL ESCAPES"
1714 Once \fBsudo\fR executes a program, that program is free to do whatever
1715 it pleases, including run other programs.  This can be a security
1716 issue since it is not uncommon for a program to allow shell escapes,
1717 which lets a user bypass \fBsudo\fR's access control and logging.
1718 Common programs that permit shell escapes include shells (obviously),
1719 editors, paginators, mail and terminal programs.
1720 .PP
1721 There are two basic approaches to this problem:
1722 .IP "restrict" 10
1723 .IX Item "restrict"
1724 Avoid giving users access to commands that allow the user to run
1725 arbitrary commands.  Many editors have a restricted mode where shell
1726 escapes are disabled, though \fBsudoedit\fR is a better solution to
1727 running editors via \fBsudo\fR.  Due to the large number of programs that
1728 offer shell escapes, restricting users to the set of programs that
1729 do not is often unworkable.
1730 .IP "noexec" 10
1731 .IX Item "noexec"
1732 Many systems that support shared libraries have the ability to
1733 override default library functions by pointing an environment
1734 variable (usually \f(CW\*(C`LD_PRELOAD\*(C'\fR) to an alternate shared library.
1735 On such systems, \fBsudo\fR's \fInoexec\fR functionality can be used to
1736 prevent a program run by \fBsudo\fR from executing any other programs.
1737 Note, however, that this applies only to native dynamically-linked
1738 executables.  Statically-linked executables and foreign executables
1739 running under binary emulation are not affected.
1740 .Sp
1741 To tell whether or not \fBsudo\fR supports \fInoexec\fR, you can run
1742 the following as root:
1743 .Sp
1744 .Vb 1
1745 \&    sudo \-V | grep "dummy exec"
1746 .Ve
1747 .Sp
1748 If the resulting output contains a line that begins with:
1749 .Sp
1750 .Vb 1
1751 \&    File containing dummy exec functions:
1752 .Ve
1753 .Sp
1754 then \fBsudo\fR may be able to replace the exec family of functions
1755 in the standard library with its own that simply return an error.
1756 Unfortunately, there is no foolproof way to know whether or not
1757 \&\fInoexec\fR will work at compile-time.  \fInoexec\fR should work on
1758 SunOS, Solaris, *BSD, Linux, \s-1IRIX\s0, Tru64 \s-1UNIX\s0, MacOS X, and HP-UX
1759 11.x.  It is known \fBnot\fR to work on \s-1AIX\s0 and UnixWare.  \fInoexec\fR
1760 is expected to work on most operating systems that support the
1761 \&\f(CW\*(C`LD_PRELOAD\*(C'\fR environment variable.  Check your operating system's
1762 manual pages for the dynamic linker (usually ld.so, ld.so.1, dyld,
1763 dld.sl, rld, or loader) to see if \f(CW\*(C`LD_PRELOAD\*(C'\fR is supported.
1764 .Sp
1765 To enable \fInoexec\fR for a command, use the \f(CW\*(C`NOEXEC\*(C'\fR tag as documented
1766 in the User Specification section above.  Here is that example again:
1767 .Sp
1768 .Vb 1
1769 \& aaron  shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
1770 .Ve
1771 .Sp
1772 This allows user \fBaaron\fR to run \fI/usr/bin/more\fR and \fI/usr/bin/vi\fR
1773 with \fInoexec\fR enabled.  This will prevent those two commands from
1774 executing other commands (such as a shell).  If you are unsure
1775 whether or not your system is capable of supporting \fInoexec\fR you
1776 can always just try it out and see if it works.
1777 .PP
1778 Note that restricting shell escapes is not a panacea.  Programs
1779 running as root are still capable of many potentially hazardous
1780 operations (such as changing or overwriting files) that could lead
1781 to unintended privilege escalation.  In the specific case of an
1782 editor, a safer approach is to give the user permission to run
1783 \&\fBsudoedit\fR.
1784 .SH "SEE ALSO"
1785 .IX Header "SEE ALSO"
1786 \&\fIrsh\fR\|(1), \fIsu\fR\|(1), \fIfnmatch\fR\|(3), \fIglob\fR\|(3), \fIsudo\fR\|(@mansectsu@), \fIvisudo\fR\|(8)
1787 .SH "CAVEATS"
1788 .IX Header "CAVEATS"
1789 The \fIsudoers\fR file should \fBalways\fR be edited by the \fBvisudo\fR
1790 command which locks the file and does grammatical checking. It is
1791 imperative that \fIsudoers\fR be free of syntax errors since \fBsudo\fR
1792 will not run with a syntactically incorrect \fIsudoers\fR file.
1793 .PP
1794 When using netgroups of machines (as opposed to users), if you
1795 store fully qualified host name in the netgroup (as is usually the
1796 case), you either need to have the machine's host name be fully qualified
1797 as returned by the \f(CW\*(C`hostname\*(C'\fR command or use the \fIfqdn\fR option in
1798 \&\fIsudoers\fR.
1799 .SH "BUGS"
1800 .IX Header "BUGS"
1801 If you feel you have found a bug in \fBsudo\fR, please submit a bug report
1802 at http://www.sudo.ws/sudo/bugs/
1803 .SH "SUPPORT"
1804 .IX Header "SUPPORT"
1805 Limited free support is available via the sudo-users mailing list,
1806 see http://www.sudo.ws/mailman/listinfo/sudo\-users to subscribe or
1807 search the archives.
1808 .SH "DISCLAIMER"
1809 .IX Header "DISCLAIMER"
1810 \&\fBsudo\fR is provided ``\s-1AS\s0 \s-1IS\s0'' and any express or implied warranties,
1811 including, but not limited to, the implied warranties of merchantability
1812 and fitness for a particular purpose are disclaimed.  See the \s-1LICENSE\s0
1813 file distributed with \fBsudo\fR or http://www.sudo.ws/sudo/license.html
1814 for complete details.