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