[BACK]Return to sudoers.5 CVS log [TXT][DIR] Up to [local] / src / usr.bin / sudo

Annotation of src/usr.bin/sudo/sudoers.5, Revision 1.22

1.17      millert     1: .\" Copyright (c) 1994-1996,1998-2004 Todd C. Miller <Todd.Miller@courtesan.com>
1.14      millert     2: .\"
1.17      millert     3: .\" Permission to use, copy, modify, and distribute this software for any
                      4: .\" purpose with or without fee is hereby granted, provided that the above
                      5: .\" copyright notice and this permission notice appear in all copies.
1.14      millert     6: .\"
1.17      millert     7: .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                      8: .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                      9: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     10: .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     11: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     12: .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     13: .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     14: .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1.14      millert    15: .\"
1.17      millert    16: .\" Sponsored in part by the Defense Advanced Research Projects
                     17: .\" Agency (DARPA) and Air Force Research Laboratory, Air Force
                     18: .\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
1.14      millert    19: .\"
1.22    ! millert    20: .\" $Sudo: sudoers.pod,v 1.96 2004/09/06 20:45:27 millert Exp $
1.17      millert    21: .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
1.9       millert    22: .\"
                     23: .\" Standard preamble:
1.15      millert    24: .\" ========================================================================
1.9       millert    25: .de Sh \" Subsection heading
1.1       millert    26: .br
                     27: .if t .Sp
                     28: .ne 5
                     29: .PP
                     30: \fB\\$1\fR
                     31: .PP
                     32: ..
1.9       millert    33: .de Sp \" Vertical space (when we can't use .PP)
1.1       millert    34: .if t .sp .5v
                     35: .if n .sp
                     36: ..
1.9       millert    37: .de Vb \" Begin verbatim text
1.1       millert    38: .ft CW
                     39: .nf
                     40: .ne \\$1
                     41: ..
1.9       millert    42: .de Ve \" End verbatim text
1.1       millert    43: .ft R
                     44: .fi
                     45: ..
1.9       millert    46: .\" Set up some character translations and predefined strings.  \*(-- will
                     47: .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
                     48: .\" double quote, and \*(R" will give a right double quote.  | will give a
1.15      millert    49: .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
                     50: .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
                     51: .\" expand to `' in nroff, nothing in troff, for use with C<>.
1.1       millert    52: .tr \(*W-|\(bv\*(Tr
1.9       millert    53: .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
1.1       millert    54: .ie n \{\
1.9       millert    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: .    ds C`
                     62: .    ds C'
1.1       millert    63: 'br\}
                     64: .el\{\
1.9       millert    65: .    ds -- \|\(em\|
                     66: .    ds PI \(*p
                     67: .    ds L" ``
                     68: .    ds R" ''
1.1       millert    69: 'br\}
1.9       millert    70: .\"
1.15      millert    71: .\" If the F register is turned on, we'll generate index entries on stderr for
                     72: .\" titles (.TH), headers (.SH), subsections (.Sh), 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.
1.9       millert    75: .if \nF \{\
                     76: .    de IX
                     77: .    tm Index:\\$1\t\\n%\t"\\$2"
1.1       millert    78: ..
1.9       millert    79: .    nr % 0
                     80: .    rr F
1.1       millert    81: .\}
1.9       millert    82: .\"
1.15      millert    83: .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
                     84: .\" way too many mistakes in technical documents.
1.9       millert    85: .hy 0
1.1       millert    86: .if n .na
1.9       millert    87: .\"
                     88: .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
                     89: .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
                     90: .    \" fudge factors for nroff and troff
1.1       millert    91: .if n \{\
1.9       millert    92: .    ds #H 0
                     93: .    ds #V .8m
                     94: .    ds #F .3m
                     95: .    ds #[ \f1
                     96: .    ds #] \fP
1.1       millert    97: .\}
                     98: .if t \{\
1.9       millert    99: .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
                    100: .    ds #V .6m
                    101: .    ds #F 0
                    102: .    ds #[ \&
                    103: .    ds #] \&
1.1       millert   104: .\}
1.9       millert   105: .    \" simple accents for nroff and troff
1.1       millert   106: .if n \{\
1.9       millert   107: .    ds ' \&
                    108: .    ds ` \&
                    109: .    ds ^ \&
                    110: .    ds , \&
                    111: .    ds ~ ~
                    112: .    ds /
1.1       millert   113: .\}
                    114: .if t \{\
1.9       millert   115: .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
                    116: .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
                    117: .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
                    118: .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
                    119: .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
                    120: .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
1.1       millert   121: .\}
1.9       millert   122: .    \" troff and (daisy-wheel) nroff accents
1.1       millert   123: .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
                    124: .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
                    125: .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
                    126: .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
                    127: .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
                    128: .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
                    129: .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
                    130: .ds ae a\h'-(\w'a'u*4/10)'e
                    131: .ds Ae A\h'-(\w'A'u*4/10)'E
1.9       millert   132: .    \" corrections for vroff
1.1       millert   133: .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
                    134: .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
1.9       millert   135: .    \" for low resolution devices (crt and lpr)
1.1       millert   136: .if \n(.H>23 .if \n(.V>19 \
                    137: \{\
1.9       millert   138: .    ds : e
                    139: .    ds 8 ss
                    140: .    ds o a
                    141: .    ds d- d\h'-1'\(ga
                    142: .    ds D- D\h'-1'\(hy
                    143: .    ds th \o'bp'
                    144: .    ds Th \o'LP'
                    145: .    ds ae ae
                    146: .    ds Ae AE
1.1       millert   147: .\}
                    148: .rm #[ #] #H #V #F C
1.15      millert   149: .\" ========================================================================
1.9       millert   150: .\"
1.15      millert   151: .IX Title "SUDOERS 5"
1.22    ! millert   152: .TH SUDOERS 5 "March 12, 2005" "1.6.8p8" "MAINTENANCE COMMANDS"
1.1       millert   153: .SH "NAME"
                    154: sudoers \- list of which users may execute what
                    155: .SH "DESCRIPTION"
1.9       millert   156: .IX Header "DESCRIPTION"
1.17      millert   157: The \fIsudoers\fR file is composed of two types of entries: aliases
                    158: (basically variables) and user specifications (which specify who
                    159: may run what).
                    160: .PP
                    161: When multiple entries match for a user, they are applied in order.
                    162: Where there are conflicting values, the last match is used (which
                    163: is not necessarily the most specific match).
                    164: .PP
                    165: The \fIsudoers\fR grammar will be described below in Extended Backus-Naur
                    166: Form (\s-1EBNF\s0).  Don't despair if you don't know what \s-1EBNF\s0 is; it is
                    167: fairly simple, and the definitions below are annotated.
1.1       millert   168: .Sh "Quick guide to \s-1EBNF\s0"
1.9       millert   169: .IX Subsection "Quick guide to EBNF"
                    170: \&\s-1EBNF\s0 is a concise and exact way of describing the grammar of a language.
1.7       pjanzen   171: Each \s-1EBNF\s0 definition is made up of \fIproduction rules\fR.  E.g.,
1.1       millert   172: .PP
                    173: .Vb 1
                    174: \& symbol ::= definition | alternate1 | alternate2 ...
                    175: .Ve
1.15      millert   176: .PP
1.1       millert   177: Each \fIproduction rule\fR references others and thus makes up a
                    178: grammar for the language.  \s-1EBNF\s0 also contains the following
                    179: operators, which many readers will recognize from regular
                    180: expressions.  Do not, however, confuse them with \*(L"wildcard\*(R"
                    181: characters, which have different meanings.
1.15      millert   182: .ie n .IP "\*(C`?\*(C'" 8
                    183: .el .IP "\f(CW\*(C`?\*(C'\fR" 8
1.9       millert   184: .IX Item "?"
1.1       millert   185: Means that the preceding symbol (or group of symbols) is optional.
                    186: That is, it may appear once or not at all.
1.15      millert   187: .ie n .IP "\*(C`*\*(C'" 8
                    188: .el .IP "\f(CW\*(C`*\*(C'\fR" 8
1.9       millert   189: .IX Item "*"
1.1       millert   190: Means that the preceding symbol (or group of symbols) may appear
                    191: zero or more times.
1.15      millert   192: .ie n .IP "\*(C`+\*(C'" 8
                    193: .el .IP "\f(CW\*(C`+\*(C'\fR" 8
1.9       millert   194: .IX Item "+"
1.1       millert   195: Means that the preceding symbol (or group of symbols) may appear
                    196: one or more times.
                    197: .PP
                    198: Parentheses may be used to group symbols together.  For clarity,
                    199: we will use single quotes ('') to designate what is a verbatim character
                    200: string (as opposed to a symbol name).
                    201: .Sh "Aliases"
1.9       millert   202: .IX Subsection "Aliases"
                    203: There are four kinds of aliases: \f(CW\*(C`User_Alias\*(C'\fR, \f(CW\*(C`Runas_Alias\*(C'\fR,
                    204: \&\f(CW\*(C`Host_Alias\*(C'\fR and \f(CW\*(C`Cmnd_Alias\*(C'\fR.
1.1       millert   205: .PP
                    206: .Vb 4
1.9       millert   207: \& Alias ::= 'User_Alias'  User_Alias (':' User_Alias)* |
                    208: \&           'Runas_Alias' Runas_Alias (':' Runas_Alias)* |
                    209: \&           'Host_Alias'  Host_Alias (':' Host_Alias)* |
                    210: \&           'Cmnd_Alias'  Cmnd_Alias (':' Cmnd_Alias)*
1.1       millert   211: .Ve
1.15      millert   212: .PP
1.1       millert   213: .Vb 1
                    214: \& User_Alias ::= NAME '=' User_List
                    215: .Ve
1.15      millert   216: .PP
1.1       millert   217: .Vb 1
1.9       millert   218: \& Runas_Alias ::= NAME '=' Runas_List
1.1       millert   219: .Ve
1.15      millert   220: .PP
1.1       millert   221: .Vb 1
                    222: \& Host_Alias ::= NAME '=' Host_List
                    223: .Ve
1.15      millert   224: .PP
1.1       millert   225: .Vb 1
                    226: \& Cmnd_Alias ::= NAME '=' Cmnd_List
                    227: .Ve
1.15      millert   228: .PP
1.1       millert   229: .Vb 1
                    230: \& NAME ::= [A-Z]([A-Z][0-9]_)*
                    231: .Ve
1.15      millert   232: .PP
1.1       millert   233: Each \fIalias\fR definition is of the form
                    234: .PP
                    235: .Vb 1
                    236: \& Alias_Type NAME = item1, item2, ...
                    237: .Ve
1.15      millert   238: .PP
1.9       millert   239: 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,
                    240: or \f(CW\*(C`Cmnd_Alias\*(C'\fR.  A \f(CW\*(C`NAME\*(C'\fR is a string of uppercase letters, numbers,
1.13      jmc       241: and underscore characters ('_').  A \f(CW\*(C`NAME\*(C'\fR \fBmust\fR start with an
1.7       pjanzen   242: uppercase letter.  It is possible to put several alias definitions
1.8       jufi      243: of the same type on a single line, joined by a colon (':').  E.g.,
1.1       millert   244: .PP
                    245: .Vb 1
                    246: \& Alias_Type NAME = item1, item2, item3 : NAME = item4, item5
                    247: .Ve
1.15      millert   248: .PP
1.1       millert   249: The definitions of what constitutes a valid \fIalias\fR member follow.
                    250: .PP
                    251: .Vb 2
                    252: \& User_List ::= User |
                    253: \&               User ',' User_List
                    254: .Ve
1.15      millert   255: .PP
1.9       millert   256: .Vb 4
1.1       millert   257: \& User ::= '!'* username |
                    258: \&          '!'* '%'group |
                    259: \&          '!'* '+'netgroup |
                    260: \&          '!'* User_Alias
                    261: .Ve
1.15      millert   262: .PP
1.17      millert   263: A \f(CW\*(C`User_List\*(C'\fR is made up of one or more usernames, system groups
                    264: (prefixed with '%'), netgroups (prefixed with '+') and other aliases.
                    265: Each list item may be prefixed with one or more '!' operators.
                    266: An odd number of '!' operators negate the value of the item; an even
                    267: number just cancel each other out.
1.1       millert   268: .PP
                    269: .Vb 2
                    270: \& Runas_List ::= Runas_User |
                    271: \&                Runas_User ',' Runas_List
                    272: .Ve
1.15      millert   273: .PP
1.1       millert   274: .Vb 5
                    275: \& Runas_User ::= '!'* username |
                    276: \&                '!'* '#'uid |
                    277: \&                '!'* '%'group |
                    278: \&                '!'* +netgroup |
                    279: \&                '!'* Runas_Alias
                    280: .Ve
1.15      millert   281: .PP
1.9       millert   282: A \f(CW\*(C`Runas_List\*(C'\fR is similar to a \f(CW\*(C`User_List\*(C'\fR except that it can
                    283: also contain uids (prefixed with '#') and instead of \f(CW\*(C`User_Alias\*(C'\fRes
1.17      millert   284: it can contain \f(CW\*(C`Runas_Alias\*(C'\fRes.  Note that usernames and groups
                    285: are matched as strings.  In other words, two users (groups) with
                    286: the same uid (gid) are considered to be distinct.  If you wish to
                    287: match all usernames with the same uid (e.g. root and toor), you
                    288: can use a uid instead (#0 in the example given).
1.1       millert   289: .PP
                    290: .Vb 2
                    291: \& Host_List ::= Host |
                    292: \&               Host ',' Host_List
                    293: .Ve
1.15      millert   294: .PP
1.1       millert   295: .Vb 5
                    296: \& Host ::= '!'* hostname |
                    297: \&          '!'* ip_addr |
                    298: \&          '!'* network(/netmask)? |
                    299: \&          '!'* '+'netgroup |
                    300: \&          '!'* Host_Alias
                    301: .Ve
1.15      millert   302: .PP
1.9       millert   303: A \f(CW\*(C`Host_List\*(C'\fR is made up of one or more hostnames, \s-1IP\s0 addresses,
                    304: network numbers, netgroups (prefixed with '+') and other aliases.
                    305: Again, the value of an item may be negated with the '!' operator.
1.1       millert   306: If you do not specify a netmask with a network number, the netmask
1.15      millert   307: of the host's ethernet interface(s) will be used when matching.
1.6       krw       308: The netmask may be specified either in dotted quad notation (e.g.
                    309: 255.255.255.0) or \s-1CIDR\s0 notation (number of bits, e.g. 24).  A hostname
1.17      millert   310: may include shell-style wildcards (see the Wildcards section below),
1.9       millert   311: but unless the \f(CW\*(C`hostname\*(C'\fR command on your machine returns the fully
1.5       millert   312: qualified hostname, you'll need to use the \fIfqdn\fR option for wildcards
                    313: to be useful.
1.1       millert   314: .PP
                    315: .Vb 2
                    316: \& Cmnd_List ::= Cmnd |
                    317: \&               Cmnd ',' Cmnd_List
                    318: .Ve
1.15      millert   319: .PP
1.1       millert   320: .Vb 3
                    321: \& commandname ::= filename |
                    322: \&                 filename args |
                    323: \&                 filename '""'
                    324: .Ve
1.15      millert   325: .PP
1.17      millert   326: .Vb 4
1.1       millert   327: \& Cmnd ::= '!'* commandname |
                    328: \&          '!'* directory |
1.17      millert   329: \&          '!'* "sudoedit" |
1.1       millert   330: \&          '!'* Cmnd_Alias
                    331: .Ve
1.15      millert   332: .PP
1.9       millert   333: A \f(CW\*(C`Cmnd_List\*(C'\fR is a list of one or more commandnames, directories, and other
1.5       millert   334: aliases.  A commandname is a fully qualified filename which may include
1.17      millert   335: shell-style wildcards (see the Wildcards section below).  A simple
1.1       millert   336: filename allows the user to run the command with any arguments he/she
1.9       millert   337: wishes.  However, you may also specify command line arguments (including
1.15      millert   338: wildcards).  Alternately, you can specify \f(CW""\fR to indicate that the command
1.1       millert   339: may only be run \fBwithout\fR command line arguments.  A directory is a
1.9       millert   340: fully qualified pathname ending in a '/'.  When you specify a directory
                    341: in a \f(CW\*(C`Cmnd_List\*(C'\fR, the user will be able to run any file within that directory
1.1       millert   342: (but not in any subdirectories therein).
                    343: .PP
1.9       millert   344: If a \f(CW\*(C`Cmnd\*(C'\fR has associated command line arguments, then the arguments
                    345: in the \f(CW\*(C`Cmnd\*(C'\fR must match exactly those given by the user on the command line
1.1       millert   346: (or match the wildcards if there are any).  Note that the following
1.9       millert   347: characters must be escaped with a '\e' if they are used in command
1.17      millert   348: arguments: ',', ':', '=', '\e'.  The special command \f(CW"sudoedit"\fR
                    349: is used to permit a user to run \fBsudo\fR with the \fB\-e\fR flag (or
                    350: as \fBsudoedit\fR).  It may take command line arguments just as
                    351: a normal command does.
1.1       millert   352: .Sh "Defaults"
1.9       millert   353: .IX Subsection "Defaults"
1.1       millert   354: Certain configuration options may be changed from their default
1.9       millert   355: values at runtime via one or more \f(CW\*(C`Default_Entry\*(C'\fR lines.  These
1.15      millert   356: may affect all users on any host, all users on a specific host, a
1.17      millert   357: specific user, or commands being run as a specific user.
1.1       millert   358: .PP
1.15      millert   359: .Vb 4
1.17      millert   360: \& Default_Type ::= 'Defaults' |
                    361: \&                  'Defaults' '@' Host |
                    362: \&                  'Defaults' ':' User |
1.15      millert   363: \&                  'Defaults' '>' RunasUser
1.1       millert   364: .Ve
1.15      millert   365: .PP
1.1       millert   366: .Vb 1
                    367: \& Default_Entry ::= Default_Type Parameter_List
                    368: .Ve
1.15      millert   369: .PP
1.17      millert   370: .Vb 2
                    371: \& Parameter_List ::= Parameter |
                    372: \&                    Parameter ',' Parameter_List
                    373: .Ve
                    374: .PP
1.9       millert   375: .Vb 4
1.17      millert   376: \& Parameter ::= Parameter '=' Value |
                    377: \&               Parameter '+=' Value |
                    378: \&               Parameter '-=' Value |
                    379: \&               '!'* Parameter
1.1       millert   380: .Ve
1.15      millert   381: .PP
1.9       millert   382: Parameters may be \fBflags\fR, \fBinteger\fR values, \fBstrings\fR, or \fBlists\fR.
                    383: Flags are implicitly boolean and can be turned off via the '!'
                    384: operator.  Some integer, string and list parameters may also be
                    385: used in a boolean context to disable them.  Values may be enclosed
                    386: in double quotes (\f(CW\*(C`"\*(C'\fR) when they contain multiple words.  Special
                    387: characters may be escaped with a backslash (\f(CW\*(C`\e\*(C'\fR).
                    388: .PP
                    389: Lists have two additional assignment operators, \f(CW\*(C`+=\*(C'\fR and \f(CW\*(C`\-=\*(C'\fR.
                    390: These operators are used to add to and delete from a list respectively.
                    391: It is not an error to use the \f(CW\*(C`\-=\*(C'\fR operator to remove an element
                    392: that does not exist in a list.
                    393: .PP
                    394: \&\fBFlags\fR:
1.15      millert   395: .IP "long_otp_prompt" 12
1.9       millert   396: .IX Item "long_otp_prompt"
1.4       millert   397: When validating with a One Time Password scheme (\fBS/Key\fR or \fB\s-1OPIE\s0\fR),
                    398: a two-line prompt is used to make it easier to cut and paste the
                    399: challenge to a local window.  It's not as pretty as the default but
1.9       millert   400: some people find it more convenient.  This flag is \fIoff\fR
                    401: by default.
1.15      millert   402: .IP "ignore_dot" 12
1.9       millert   403: .IX Item "ignore_dot"
                    404: If set, \fBsudo\fR will ignore '.' or '' (current dir) in the \f(CW\*(C`PATH\*(C'\fR
                    405: environment variable; the \f(CW\*(C`PATH\*(C'\fR itself is not modified.  This
1.17      millert   406: flag is \fIoff\fR by default.  Currently, while it is possible
                    407: to set \fIignore_dot\fR in \fIsudoers\fR, its value is not used.  This option
                    408: should be considered read-only (it will be fixed in a future version
                    409: of \fBsudo\fR).
1.15      millert   410: .IP "mail_always" 12
1.9       millert   411: .IX Item "mail_always"
1.5       millert   412: Send mail to the \fImailto\fR user every time a users runs \fBsudo\fR.
1.9       millert   413: This flag is \fIoff\fR by default.
1.15      millert   414: .IP "mail_badpass" 12
1.9       millert   415: .IX Item "mail_badpass"
                    416: Send mail to the \fImailto\fR user if the user running sudo does not
                    417: enter the correct password.  This flag is \fIoff\fR by default.
1.15      millert   418: .IP "mail_no_user" 12
1.9       millert   419: .IX Item "mail_no_user"
1.4       millert   420: If set, mail will be sent to the \fImailto\fR user if the invoking
1.9       millert   421: user is not in the \fIsudoers\fR file.  This flag is \fIon\fR
                    422: by default.
1.15      millert   423: .IP "mail_no_host" 12
1.9       millert   424: .IX Item "mail_no_host"
1.4       millert   425: If set, mail will be sent to the \fImailto\fR user if the invoking
                    426: user exists in the \fIsudoers\fR file, but is not allowed to run
1.9       millert   427: commands on the current host.  This flag is \fIoff\fR by default.
1.15      millert   428: .IP "mail_no_perms" 12
1.9       millert   429: .IX Item "mail_no_perms"
1.4       millert   430: If set, mail will be sent to the \fImailto\fR user if the invoking
1.13      jmc       431: user is allowed to use \fBsudo\fR but the command they are trying is not
1.17      millert   432: listed in their \fIsudoers\fR file entry or is explicitly denied.
                    433: This flag is \fIoff\fR by default.
1.15      millert   434: .IP "tty_tickets" 12
1.9       millert   435: .IX Item "tty_tickets"
1.4       millert   436: If set, users must authenticate on a per-tty basis.  Normally,
1.9       millert   437: \&\fBsudo\fR uses a directory in the ticket dir with the same name as
1.4       millert   438: the user running it.  With this flag enabled, \fBsudo\fR will use a
                    439: file named for the tty the user is logged in on in that directory.
1.9       millert   440: This flag is \fIoff\fR by default.
1.15      millert   441: .IP "authenticate" 12
1.9       millert   442: .IX Item "authenticate"
1.4       millert   443: If set, users must authenticate themselves via a password (or other
                    444: means of authentication) before they may run commands.  This default
1.9       millert   445: may be overridden via the \f(CW\*(C`PASSWD\*(C'\fR and \f(CW\*(C`NOPASSWD\*(C'\fR tags.
                    446: This flag is \fIon\fR by default.
1.15      millert   447: .IP "root_sudo" 12
1.9       millert   448: .IX Item "root_sudo"
1.5       millert   449: If set, root is allowed to run \fBsudo\fR too.  Disabling this prevents users
                    450: from \*(L"chaining\*(R" \fBsudo\fR commands to get a root shell by doing something
1.17      millert   451: like \f(CW"sudo sudo /bin/sh"\fR.  Note, however, that turning off \fIroot_sudo\fR
                    452: will also prevent root and from running \fBsudoedit\fR.
                    453: Disabling \fIroot_sudo\fR provides no real additional security; it
                    454: exists purely for historical reasons.
1.9       millert   455: This flag is \fIon\fR by default.
1.15      millert   456: .IP "log_host" 12
1.9       millert   457: .IX Item "log_host"
1.15      millert   458: If set, the hostname will be logged in the (non\-syslog) \fBsudo\fR log file.
1.9       millert   459: This flag is \fIoff\fR by default.
1.15      millert   460: .IP "log_year" 12
1.9       millert   461: .IX Item "log_year"
1.15      millert   462: If set, the four-digit year will be logged in the (non\-syslog) \fBsudo\fR log file.
1.9       millert   463: This flag is \fIoff\fR by default.
1.15      millert   464: .IP "shell_noargs" 12
1.9       millert   465: .IX Item "shell_noargs"
1.4       millert   466: If set and \fBsudo\fR is invoked with no arguments it acts as if the
1.9       millert   467: \&\fB\-s\fR flag had been given.  That is, it runs a shell as root (the
                    468: shell is determined by the \f(CW\*(C`SHELL\*(C'\fR environment variable if it is
1.4       millert   469: set, falling back on the shell listed in the invoking user's
1.9       millert   470: /etc/passwd entry if not).  This flag is \fIoff\fR by default.
1.15      millert   471: .IP "set_home" 12
1.9       millert   472: .IX Item "set_home"
                    473: If set and \fBsudo\fR is invoked with the \fB\-s\fR flag the \f(CW\*(C`HOME\*(C'\fR
1.4       millert   474: environment variable will be set to the home directory of the target
1.9       millert   475: user (which is root unless the \fB\-u\fR option is used).  This effectively
                    476: makes the \fB\-s\fR flag imply \fB\-H\fR.  This flag is \fIoff\fR by default.
1.15      millert   477: .IP "always_set_home" 12
1.9       millert   478: .IX Item "always_set_home"
                    479: If set, \fBsudo\fR will set the \f(CW\*(C`HOME\*(C'\fR environment variable to the home
                    480: directory of the target user (which is root unless the \fB\-u\fR option is used).
                    481: This effectively means that the \fB\-H\fR flag is always implied.
                    482: This flag is \fIoff\fR by default.
1.15      millert   483: .IP "path_info" 12
1.9       millert   484: .IX Item "path_info"
1.4       millert   485: Normally, \fBsudo\fR will tell the user when a command could not be
1.9       millert   486: found in their \f(CW\*(C`PATH\*(C'\fR environment variable.  Some sites may wish
                    487: to disable this as it could be used to gather information on the
                    488: location of executables that the normal user does not have access
                    489: to.  The disadvantage is that if the executable is simply not in
                    490: the user's \f(CW\*(C`PATH\*(C'\fR, \fBsudo\fR will tell the user that they are not
                    491: allowed to run it, which can be confusing.  This flag is \fIoff\fR by
                    492: default.
1.15      millert   493: .IP "preserve_groups" 12
1.9       millert   494: .IX Item "preserve_groups"
                    495: By default \fBsudo\fR will initialize the group vector to the list of
                    496: groups the target user is in.  When \fIpreserve_groups\fR is set, the
                    497: user's existing group vector is left unaltered.  The real and
                    498: effective group IDs, however, are still set to match the target
                    499: user.  This flag is \fIoff\fR by default.
1.15      millert   500: .IP "fqdn" 12
1.9       millert   501: .IX Item "fqdn"
1.4       millert   502: Set this flag if you want to put fully qualified hostnames in the
1.13      jmc       503: \&\fIsudoers\fR file.  I.e., instead of myhost you would use myhost.mydomain.edu.
1.4       millert   504: You may still use the short form if you wish (and even mix the two).
1.5       millert   505: Beware that turning on \fIfqdn\fR requires \fBsudo\fR to make \s-1DNS\s0 lookups
1.4       millert   506: which may make \fBsudo\fR unusable if \s-1DNS\s0 stops working (for example
                    507: if the machine is not plugged into the network).  Also note that
                    508: you must use the host's official name as \s-1DNS\s0 knows it.  That is,
1.9       millert   509: you may not use a host alias (\f(CW\*(C`CNAME\*(C'\fR entry) due to performance
1.4       millert   510: issues and the fact that there is no way to get all aliases from
1.9       millert   511: \&\s-1DNS\s0.  If your machine's hostname (as returned by the \f(CW\*(C`hostname\*(C'\fR
1.4       millert   512: command) is already fully qualified you shouldn't need to set
1.9       millert   513: \&\fIfqdn\fR.  This flag is \fIoff\fR by default.
1.15      millert   514: .IP "insults" 12
1.9       millert   515: .IX Item "insults"
1.5       millert   516: If set, \fBsudo\fR will insult users when they enter an incorrect
1.9       millert   517: password.  This flag is \fIon\fR by default.
1.15      millert   518: .IP "requiretty" 12
1.9       millert   519: .IX Item "requiretty"
1.5       millert   520: If set, \fBsudo\fR will only run when the user is logged in to a real
1.15      millert   521: tty.  This will disallow things like \f(CW"rsh somehost sudo ls"\fR since
1.9       millert   522: \&\fIrsh\fR\|(1) does not allocate a tty.  Because it is not possible to turn
1.15      millert   523: off echo when there is no tty present, some sites may with to set
1.4       millert   524: this flag to prevent a user from entering a visible password.  This
1.9       millert   525: flag is \fIoff\fR by default.
1.15      millert   526: .IP "env_editor" 12
1.9       millert   527: .IX Item "env_editor"
                    528: If set, \fBvisudo\fR will use the value of the \s-1EDITOR\s0 or \s-1VISUAL\s0
                    529: environment variables before falling back on the default editor list.
                    530: Note that this may create a security hole as it allows the user to
                    531: run any arbitrary command as root without logging.  A safer alternative
                    532: is to place a colon-separated list of editors in the \f(CW\*(C`editor\*(C'\fR
                    533: variable.  \fBvisudo\fR will then only use the \s-1EDITOR\s0 or \s-1VISUAL\s0 if
                    534: they match a value specified in \f(CW\*(C`editor\*(C'\fR.  This flag is \f(CW\*(C`on\*(C'\fR by
                    535: default.
1.15      millert   536: .IP "rootpw" 12
1.9       millert   537: .IX Item "rootpw"
1.5       millert   538: If set, \fBsudo\fR will prompt for the root password instead of the password
1.9       millert   539: of the invoking user.  This flag is \fIoff\fR by default.
1.15      millert   540: .IP "runaspw" 12
1.9       millert   541: .IX Item "runaspw"
1.5       millert   542: If set, \fBsudo\fR will prompt for the password of the user defined by the
1.17      millert   543: \&\fIrunas_default\fR option (defaults to \f(CW\*(C`root\*(C'\fR) instead of the
                    544: password of the invoking user.  This flag is \fIoff\fR by default.
1.15      millert   545: .IP "targetpw" 12
1.9       millert   546: .IX Item "targetpw"
1.5       millert   547: If set, \fBsudo\fR will prompt for the password of the user specified by
1.9       millert   548: the \fB\-u\fR flag (defaults to \f(CW\*(C`root\*(C'\fR) instead of the password of the
1.17      millert   549: invoking user.  Note that this precludes the use of a uid not listed
                    550: in the passwd database as an argument to the \fB\-u\fR flag.
                    551: This flag is \fIoff\fR by default.
1.15      millert   552: .IP "set_logname" 12
1.9       millert   553: .IX Item "set_logname"
                    554: Normally, \fBsudo\fR will set the \f(CW\*(C`LOGNAME\*(C'\fR and \f(CW\*(C`USER\*(C'\fR environment variables
                    555: to the name of the target user (usually root unless the \fB\-u\fR flag is given).
1.5       millert   556: However, since some programs (including the \s-1RCS\s0 revision control system)
1.9       millert   557: use \f(CW\*(C`LOGNAME\*(C'\fR to determine the real identity of the user, it may be desirable
1.5       millert   558: to change this behavior.  This can be done by negating the set_logname option.
1.15      millert   559: .IP "stay_setuid" 12
1.9       millert   560: .IX Item "stay_setuid"
                    561: Normally, when \fBsudo\fR executes a command the real and effective
                    562: UIDs are set to the target user (root by default).  This option
                    563: changes that behavior such that the real \s-1UID\s0 is left as the invoking
                    564: user's \s-1UID\s0.  In other words, this makes \fBsudo\fR act as a setuid
                    565: wrapper.  This can be useful on systems that disable some potentially
1.10      millert   566: dangerous functionality when a program is run setuid.  Note, however,
                    567: that this means that sudo will run with the real uid of the invoking
                    568: user which may allow that user to kill \fBsudo\fR before it can log a
                    569: failure, depending on how your \s-1OS\s0 defines the interaction between
                    570: signals and setuid processes.
1.15      millert   571: .IP "env_reset" 12
1.9       millert   572: .IX Item "env_reset"
                    573: If set, \fBsudo\fR will reset the environment to only contain the
                    574: following variables: \f(CW\*(C`HOME\*(C'\fR, \f(CW\*(C`LOGNAME\*(C'\fR, \f(CW\*(C`PATH\*(C'\fR, \f(CW\*(C`SHELL\*(C'\fR, \f(CW\*(C`TERM\*(C'\fR,
                    575: and \f(CW\*(C`USER\*(C'\fR (in addition to the \f(CW\*(C`SUDO_*\*(C'\fR variables).
                    576: Of these, only \f(CW\*(C`TERM\*(C'\fR is copied unaltered from the old environment.
                    577: The other variables are set to default values (possibly modified
                    578: by the value of the \fIset_logname\fR option).  If \fBsudo\fR was compiled
                    579: with the \f(CW\*(C`SECURE_PATH\*(C'\fR option, its value will be used for the \f(CW\*(C`PATH\*(C'\fR
                    580: environment variable.
                    581: Other variables may be preserved with the \fIenv_keep\fR option.
1.15      millert   582: .IP "use_loginclass" 12
1.9       millert   583: .IX Item "use_loginclass"
                    584: If set, \fBsudo\fR will apply the defaults specified for the target user's
                    585: login class if one exists.  Only available if \fBsudo\fR is configured with
1.15      millert   586: the \-\-with\-logincap option.  This flag is \fIoff\fR by default.
1.17      millert   587: .IP "noexec" 12
                    588: .IX Item "noexec"
                    589: If set, all commands run via sudo will behave as if the \f(CW\*(C`NOEXEC\*(C'\fR
                    590: tag has been set, unless overridden by a \f(CW\*(C`EXEC\*(C'\fR tag.  See the
                    591: description of \fI\s-1NOEXEC\s0 and \s-1EXEC\s0\fR below as well as the \*(L"\s-1PREVENTING\s0 \s-1SHELL\s0 \s-1ESCAPES\s0\*(R" section at the end of this manual.  This flag is \fIoff\fR by default.
                    592: .IP "ignore_local_sudoers" 12
                    593: .IX Item "ignore_local_sudoers"
                    594: If set via \s-1LDAP\s0, parsing of \f(CW@sysconfdir\fR@/sudoers will be skipped.
                    595: This is intended for an Enterprises that wish to prevent the usage of local
                    596: sudoers files so that only \s-1LDAP\s0 is used.  This thwarts the efforts of
                    597: rogue operators who would attempt to add roles to \f(CW@sysconfdir\fR@/sudoers.
                    598: When this option is present, \f(CW@sysconfdir\fR@/sudoers does not even need to exist.
                    599: Since this options tells sudo how to behave when no specific \s-1LDAP\s0 entries
                    600: have been matched, this sudoOption is only meaningful for the cn=defaults
                    601: section.  This flag is \fIoff\fR by default.
1.1       millert   602: .PP
1.9       millert   603: \&\fBIntegers\fR:
1.15      millert   604: .IP "passwd_tries" 12
1.9       millert   605: .IX Item "passwd_tries"
1.4       millert   606: The number of tries a user gets to enter his/her password before
1.9       millert   607: \&\fBsudo\fR logs the failure and exits.  The default is \f(CW\*(C`3\*(C'\fR.
1.1       millert   608: .PP
1.9       millert   609: \&\fBIntegers that can be used in a boolean context\fR:
1.15      millert   610: .IP "loglinelen" 12
1.9       millert   611: .IX Item "loglinelen"
1.4       millert   612: Number of characters per line for the file log.  This value is used
                    613: to decide when to wrap lines for nicer log files.  This has no
                    614: effect on the syslog log file, only the file log.  The default is
1.9       millert   615: \&\f(CW\*(C`80\*(C'\fR (use 0 or negate the option to disable word wrap).
1.15      millert   616: .IP "timestamp_timeout" 12
1.9       millert   617: .IX Item "timestamp_timeout"
                    618: Number of minutes that can elapse before \fBsudo\fR will ask for a
1.15      millert   619: passwd again.  The default is \f(CW\*(C`5\*(C'\fR.  Set this to \f(CW0\fR to always
1.9       millert   620: prompt for a password.
1.15      millert   621: If set to a value less than \f(CW0\fR the user's timestamp will never
1.9       millert   622: expire.  This can be used to allow users to create or delete their
                    623: own timestamps via \f(CW\*(C`sudo \-v\*(C'\fR and \f(CW\*(C`sudo \-k\*(C'\fR respectively.
1.15      millert   624: .IP "passwd_timeout" 12
1.9       millert   625: .IX Item "passwd_timeout"
1.5       millert   626: Number of minutes before the \fBsudo\fR password prompt times out.
1.15      millert   627: The default is \f(CW\*(C`5\*(C'\fR, set this to \f(CW0\fR for no password timeout.
                    628: .IP "umask" 12
1.9       millert   629: .IX Item "umask"
                    630: Umask to use when running the command.  Negate this option or set
                    631: it to 0777 to preserve the user's umask.  The default is \f(CW\*(C`0022\*(C'\fR.
1.1       millert   632: .PP
1.9       millert   633: \&\fBStrings\fR:
1.15      millert   634: .IP "mailsub" 12
1.9       millert   635: .IX Item "mailsub"
1.15      millert   636: Subject of the mail sent to the \fImailto\fR user. The escape \f(CW%h\fR
1.4       millert   637: will expand to the hostname of the machine.
1.9       millert   638: Default is \f(CW\*(C`*** SECURITY information for %h ***\*(C'\fR.
1.15      millert   639: .IP "badpass_message" 12
1.9       millert   640: .IX Item "badpass_message"
1.4       millert   641: Message that is displayed if a user enters an incorrect password.
1.9       millert   642: The default is \f(CW\*(C`Sorry, try again.\*(C'\fR unless insults are enabled.
1.15      millert   643: .IP "timestampdir" 12
1.9       millert   644: .IX Item "timestampdir"
1.4       millert   645: The directory in which \fBsudo\fR stores its timestamp files.
1.9       millert   646: The default is \fI/var/run/sudo\fR.
1.15      millert   647: .IP "timestampowner" 12
                    648: .IX Item "timestampowner"
                    649: The owner of the timestamp directory and the timestamps stored therein.
                    650: The default is \f(CW\*(C`root\*(C'\fR.
                    651: .IP "passprompt" 12
1.9       millert   652: .IX Item "passprompt"
1.4       millert   653: The default prompt to use when asking for a password; can be overridden
1.15      millert   654: via the \fB\-p\fR option or the \f(CW\*(C`SUDO_PROMPT\*(C'\fR environment variable.
                    655: The following percent (`\f(CW\*(C`%\*(C'\fR') escapes are supported:
                    656: .RS 12
                    657: .ie n .IP "%u" 8
                    658: .el .IP "\f(CW%u\fR" 8
                    659: .IX Item "%u"
                    660: expanded to the invoking user's login name
                    661: .ie n .IP "%U" 8
                    662: .el .IP "\f(CW%U\fR" 8
                    663: .IX Item "%U"
                    664: expanded to the login name of the user the command will
                    665: be run as (defaults to root)
                    666: .ie n .IP "%h" 8
                    667: .el .IP "\f(CW%h\fR" 8
                    668: .IX Item "%h"
                    669: expanded to the local hostname without the domain name
                    670: .ie n .IP "%H" 8
                    671: .el .IP "\f(CW%H\fR" 8
                    672: .IX Item "%H"
                    673: expanded to the local hostname including the domain name
                    674: (on if the machine's hostname is fully qualified or the \fIfqdn\fR
                    675: option is set)
                    676: .ie n .IP "\*(C`%%\*(C'" 8
                    677: .el .IP "\f(CW\*(C`%%\*(C'\fR" 8
                    678: .IX Item "%%"
                    679: two consecutive \f(CW\*(C`%\*(C'\fR characters are collaped into a single \f(CW\*(C`%\*(C'\fR character
                    680: .RE
                    681: .RS 12
                    682: .Sp
                    683: The default value is \f(CW\*(C`Password:\*(C'\fR.
                    684: .RE
                    685: .IP "runas_default" 12
1.9       millert   686: .IX Item "runas_default"
                    687: The default user to run commands as if the \fB\-u\fR flag is not specified
                    688: on the command line.  This defaults to \f(CW\*(C`root\*(C'\fR.
1.17      millert   689: Note that if \fIrunas_default\fR is set it \fBmust\fR occur before
                    690: any \f(CW\*(C`Runas_Alias\*(C'\fR specifications.
1.15      millert   691: .IP "syslog_goodpri" 12
1.9       millert   692: .IX Item "syslog_goodpri"
1.4       millert   693: Syslog priority to use when user authenticates successfully.
1.9       millert   694: Defaults to \f(CW\*(C`notice\*(C'\fR.
1.15      millert   695: .IP "syslog_badpri" 12
1.9       millert   696: .IX Item "syslog_badpri"
1.4       millert   697: Syslog priority to use when user authenticates unsuccessfully.
1.9       millert   698: Defaults to \f(CW\*(C`alert\*(C'\fR.
1.15      millert   699: .IP "editor" 12
1.9       millert   700: .IX Item "editor"
                    701: A colon (':') separated list of editors allowed to be used with
                    702: \&\fBvisudo\fR.  \fBvisudo\fR will choose the editor that matches the user's
                    703: \&\s-1USER\s0 environment variable if possible, or the first editor in the
                    704: list that exists and is executable.  The default is the path to vi
                    705: on your system.
1.17      millert   706: .IP "noexec_file" 12
                    707: .IX Item "noexec_file"
                    708: Path to a shared library containing dummy versions of the \fIexecv()\fR,
                    709: \&\fIexecve()\fR and \fIfexecve()\fR library functions that just return an error.
                    710: This is used to implement the \fInoexec\fR functionality on systems that
                    711: support \f(CW\*(C`LD_PRELOAD\*(C'\fR or its equivalent.  Defaults to \fI/usr/libexec/sudo_noexec.so\fR.
1.1       millert   712: .PP
1.9       millert   713: \&\fBStrings that can be used in a boolean context\fR:
1.17      millert   714: .IP "lecture" 12
                    715: .IX Item "lecture"
                    716: This option controls when a short lecture will be printed along with
                    717: the password prompt.  It has the following possible values:
                    718: .RS 12
                    719: .IP "never" 8
                    720: .IX Item "never"
                    721: Never lecture the user.
                    722: .IP "once" 8
                    723: .IX Item "once"
                    724: Only lecture the user the first time they run \fBsudo\fR.
                    725: .IP "always" 8
                    726: .IX Item "always"
                    727: Always lecture the user.
                    728: .RE
                    729: .RS 12
                    730: .Sp
1.20      millert   731: If no value is specified, a value of \fIonce\fR is implied.
                    732: Negating the option results in a value of \fInever\fR being used.
1.17      millert   733: The default value is \fIonce\fR.
                    734: .RE
                    735: .IP "lecture_file" 12
                    736: .IX Item "lecture_file"
                    737: Path to a file containing an alternate sudo lecture that will
                    738: be used in place of the standard lecture if the named file exists.
1.15      millert   739: .IP "logfile" 12
1.9       millert   740: .IX Item "logfile"
1.5       millert   741: Path to the \fBsudo\fR log file (not the syslog log file).  Setting a path
1.7       pjanzen   742: turns on logging to a file; negating this option turns it off.
1.15      millert   743: .IP "syslog" 12
1.9       millert   744: .IX Item "syslog"
1.4       millert   745: Syslog facility if syslog is being used for logging (negate to
1.17      millert   746: disable syslog logging).  Defaults to \f(CW\*(C`authpriv\*(C'\fR.
1.15      millert   747: .IP "mailerpath" 12
1.9       millert   748: .IX Item "mailerpath"
1.4       millert   749: Path to mail program used to send warning mail.
                    750: Defaults to the path to sendmail found at configure time.
1.15      millert   751: .IP "mailerflags" 12
1.9       millert   752: .IX Item "mailerflags"
                    753: Flags to use when invoking mailer. Defaults to \fB\-t\fR.
1.15      millert   754: .IP "mailto" 12
1.9       millert   755: .IX Item "mailto"
                    756: Address to send warning and error mail to.  The address should
                    757: be enclosed in double quotes (\f(CW\*(C`"\*(C'\fR) to protect against sudo
                    758: interpreting the \f(CW\*(C`@\*(C'\fR sign.  Defaults to \f(CW\*(C`root\*(C'\fR.
1.15      millert   759: .IP "exempt_group" 12
1.9       millert   760: .IX Item "exempt_group"
1.4       millert   761: Users in this group are exempt from password and \s-1PATH\s0 requirements.
                    762: This is not set by default.
1.15      millert   763: .IP "verifypw" 12
1.9       millert   764: .IX Item "verifypw"
                    765: This option controls when a password will be required when a user runs
                    766: \&\fBsudo\fR with the \fB\-v\fR flag.  It has the following possible values:
                    767: .RS 12
1.15      millert   768: .IP "all" 8
1.9       millert   769: .IX Item "all"
                    770: All the user's \fIsudoers\fR entries for the current host must have
                    771: the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
1.15      millert   772: .IP "any" 8
1.9       millert   773: .IX Item "any"
                    774: At least one of the user's \fIsudoers\fR entries for the current host
                    775: must have the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
1.15      millert   776: .IP "never" 8
1.9       millert   777: .IX Item "never"
                    778: The user need never enter a password to use the \fB\-v\fR flag.
1.15      millert   779: .IP "always" 8
1.9       millert   780: .IX Item "always"
                    781: The user must always enter a password to use the \fB\-v\fR flag.
                    782: .RE
                    783: .RS 12
1.3       millert   784: .Sp
1.20      millert   785: If no value is specified, a value of \fIall\fR is implied.
                    786: Negating the option results in a value of \fInever\fR being used.
                    787: The default value is \fIall\fR.
1.9       millert   788: .RE
1.15      millert   789: .IP "listpw" 12
1.9       millert   790: .IX Item "listpw"
1.3       millert   791: This option controls when a password will be required when a
1.15      millert   792: user runs \fBsudo\fR with the \fB\-l\fR flag.  It has the following possible values:
1.9       millert   793: .RS 12
1.15      millert   794: .IP "all" 8
1.9       millert   795: .IX Item "all"
                    796: All the user's \fIsudoers\fR entries for the current host must have
                    797: the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
1.15      millert   798: .IP "any" 8
1.9       millert   799: .IX Item "any"
                    800: At least one of the user's \fIsudoers\fR entries for the current host
                    801: must have the \f(CW\*(C`NOPASSWD\*(C'\fR flag set to avoid entering a password.
1.15      millert   802: .IP "never" 8
1.9       millert   803: .IX Item "never"
                    804: The user need never enter a password to use the \fB\-l\fR flag.
1.15      millert   805: .IP "always" 8
1.9       millert   806: .IX Item "always"
                    807: The user must always enter a password to use the \fB\-l\fR flag.
                    808: .RE
                    809: .RS 12
1.3       millert   810: .Sp
1.20      millert   811: If no value is specified, a value of \fIany\fR is implied.
                    812: Negating the option results in a value of \fInever\fR being used.
                    813: The default value is \fIany\fR.
1.9       millert   814: .RE
                    815: .PP
                    816: \&\fBLists that can be used in a boolean context\fR:
1.15      millert   817: .IP "env_check" 12
1.9       millert   818: .IX Item "env_check"
                    819: Environment variables to be removed from the user's environment if
                    820: the variable's value contains \f(CW\*(C`%\*(C'\fR or \f(CW\*(C`/\*(C'\fR characters.  This can
1.13      jmc       821: be used to guard against printf-style format vulnerabilities in
1.15      millert   822: poorly-written programs.  The argument may be a double\-quoted,
                    823: space-separated list or a single value without double\-quotes.  The
1.9       millert   824: list can be replaced, added to, deleted from, or disabled by using
                    825: the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and \f(CW\*(C`!\*(C'\fR operators respectively.  The default
1.13      jmc       826: list of environment variables to check is printed when \fBsudo\fR is
1.9       millert   827: run by root with the \fI\-V\fR option.
1.15      millert   828: .IP "env_delete" 12
1.9       millert   829: .IX Item "env_delete"
                    830: Environment variables to be removed from the user's environment.
1.15      millert   831: The argument may be a double\-quoted, space-separated list or a
                    832: single value without double\-quotes.  The list can be replaced, added
1.9       millert   833: to, deleted from, or disabled by using the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and
                    834: \&\f(CW\*(C`!\*(C'\fR operators respectively.  The default list of environment
1.13      jmc       835: variables to remove is printed when \fBsudo\fR is run by root with the
1.15      millert   836: \&\fI\-V\fR option.  Note that many operating systems will remove potentially
                    837: dangerous variables from the environment of any setuid process (such
                    838: as \fBsudo\fR).
                    839: .IP "env_keep" 12
1.9       millert   840: .IX Item "env_keep"
                    841: Environment variables to be preserved in the user's environment
                    842: when the \fIenv_reset\fR option is in effect.  This allows fine-grained
                    843: control over the environment \fBsudo\fR\-spawned processes will receive.
1.15      millert   844: The argument may be a double\-quoted, space-separated list or a
                    845: single value without double\-quotes.  The list can be replaced, added
1.9       millert   846: to, deleted from, or disabled by using the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and
                    847: \&\f(CW\*(C`!\*(C'\fR operators respectively.  This list has no default members.
1.1       millert   848: .PP
1.17      millert   849: When logging via \fIsyslog\fR\|(3), \fBsudo\fR accepts the following values
                    850: for the syslog facility (the value of the \fBsyslog\fR Parameter):
                    851: \&\fBauthpriv\fR (if your \s-1OS\s0 supports it), \fBauth\fR, \fBdaemon\fR, \fBuser\fR,
                    852: \&\fBlocal0\fR, \fBlocal1\fR, \fBlocal2\fR, \fBlocal3\fR, \fBlocal4\fR, \fBlocal5\fR,
                    853: \&\fBlocal6\fR, and \fBlocal7\fR.  The following syslog priorities are
                    854: supported: \fBalert\fR, \fBcrit\fR, \fBdebug\fR, \fBemerg\fR, \fBerr\fR, \fBinfo\fR,
                    855: \&\fBnotice\fR, and \fBwarning\fR.
1.1       millert   856: .Sh "User Specification"
1.9       millert   857: .IX Subsection "User Specification"
1.3       millert   858: .Vb 2
1.17      millert   859: \& User_Spec ::= User_List Host_List '=' Cmnd_Spec_List \e
                    860: \&               (':' Host_List '=' Cmnd_Spec_List)*
1.1       millert   861: .Ve
1.15      millert   862: .PP
1.1       millert   863: .Vb 2
                    864: \& Cmnd_Spec_List ::= Cmnd_Spec |
                    865: \&                    Cmnd_Spec ',' Cmnd_Spec_List
                    866: .Ve
1.15      millert   867: .PP
1.1       millert   868: .Vb 1
1.17      millert   869: \& Cmnd_Spec ::= Runas_Spec? Tag_Spec* Cmnd
1.3       millert   870: .Ve
1.15      millert   871: .PP
1.3       millert   872: .Vb 1
                    873: \& Runas_Spec ::= '(' Runas_List ')'
1.1       millert   874: .Ve
1.15      millert   875: .PP
1.17      millert   876: .Vb 1
                    877: \& Tag_Spec ::= ('NOPASSWD:' | 'PASSWD:' | 'NOEXEC:' | 'EXEC:')
                    878: .Ve
                    879: .PP
1.1       millert   880: A \fBuser specification\fR determines which commands a user may run
                    881: (and as what user) on specified hosts.  By default, commands are
1.7       pjanzen   882: run as \fBroot\fR, but this can be changed on a per-command basis.
1.1       millert   883: .PP
                    884: Let's break that down into its constituent parts:
                    885: .Sh "Runas_Spec"
1.9       millert   886: .IX Subsection "Runas_Spec"
                    887: A \f(CW\*(C`Runas_Spec\*(C'\fR is simply a \f(CW\*(C`Runas_List\*(C'\fR (as defined above)
1.1       millert   888: enclosed in a set of parentheses.  If you do not specify a
1.9       millert   889: \&\f(CW\*(C`Runas_Spec\*(C'\fR in the user specification, a default \f(CW\*(C`Runas_Spec\*(C'\fR
                    890: of \fBroot\fR will be used.  A \f(CW\*(C`Runas_Spec\*(C'\fR sets the default for
1.1       millert   891: commands that follow it.  What this means is that for the entry:
                    892: .PP
                    893: .Vb 1
1.13      jmc       894: \& dgb    boulder = (operator) /bin/ls, /bin/kill, /usr/bin/lprm
1.1       millert   895: .Ve
1.15      millert   896: .PP
1.1       millert   897: The user \fBdgb\fR may run \fI/bin/ls\fR, \fI/bin/kill\fR, and
1.9       millert   898: \&\fI/usr/bin/lprm\fR \*(-- but only as \fBoperator\fR.  E.g.,
1.1       millert   899: .PP
                    900: .Vb 1
1.17      millert   901: \& $ sudo -u operator /bin/ls.
1.1       millert   902: .Ve
1.15      millert   903: .PP
1.9       millert   904: It is also possible to override a \f(CW\*(C`Runas_Spec\*(C'\fR later on in an
1.1       millert   905: entry.  If we modify the entry like so:
                    906: .PP
                    907: .Vb 1
                    908: \& dgb    boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm
                    909: .Ve
1.15      millert   910: .PP
1.1       millert   911: Then user \fBdgb\fR is now allowed to run \fI/bin/ls\fR as \fBoperator\fR,
                    912: but  \fI/bin/kill\fR and \fI/usr/bin/lprm\fR as \fBroot\fR.
1.17      millert   913: .Sh "Tag_Spec"
                    914: .IX Subsection "Tag_Spec"
                    915: A command may have zero or more tags associated with it.  There are
                    916: four possible tag values, \f(CW\*(C`NOPASSWD\*(C'\fR, \f(CW\*(C`PASSWD\*(C'\fR, \f(CW\*(C`NOEXEC\*(C'\fR, \f(CW\*(C`EXEC\*(C'\fR.
                    917: Once a tag is set on a \f(CW\*(C`Cmnd\*(C'\fR, subsequent \f(CW\*(C`Cmnd\*(C'\fRs in the
                    918: \&\f(CW\*(C`Cmnd_Spec_List\*(C'\fR, inherit the tag unless it is overridden by the
                    919: opposite tag (ie: \f(CW\*(C`PASSWD\*(C'\fR overrides \f(CW\*(C`NOPASSWD\*(C'\fR and \f(CW\*(C`EXEC\*(C'\fR
                    920: overrides \f(CW\*(C`NOEXEC\*(C'\fR).
                    921: .PP
                    922: \fI\s-1NOPASSWD\s0 and \s-1PASSWD\s0\fR
1.9       millert   923: .IX Subsection "NOPASSWD and PASSWD"
1.17      millert   924: .PP
1.1       millert   925: By default, \fBsudo\fR requires that a user authenticate him or herself
                    926: before running a command.  This behavior can be modified via the
1.9       millert   927: \&\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
                    928: a default for the commands that follow it in the \f(CW\*(C`Cmnd_Spec_List\*(C'\fR.
                    929: Conversely, the \f(CW\*(C`PASSWD\*(C'\fR tag can be used to reverse things.
1.1       millert   930: For example:
                    931: .PP
                    932: .Vb 1
                    933: \& ray    rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
                    934: .Ve
1.15      millert   935: .PP
1.1       millert   936: would allow the user \fBray\fR to run \fI/bin/kill\fR, \fI/bin/ls\fR, and
1.9       millert   937: \&\fI/usr/bin/lprm\fR as root on the machine rushmore as \fBroot\fR without
1.1       millert   938: authenticating himself.  If we only want \fBray\fR to be able to
                    939: run \fI/bin/kill\fR without a password the entry would be:
                    940: .PP
                    941: .Vb 1
                    942: \& ray    rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
                    943: .Ve
1.15      millert   944: .PP
1.9       millert   945: Note, however, that the \f(CW\*(C`PASSWD\*(C'\fR tag has no effect on users who are
1.3       millert   946: in the group specified by the exempt_group option.
                    947: .PP
1.9       millert   948: By default, if the \f(CW\*(C`NOPASSWD\*(C'\fR tag is applied to any of the entries
1.3       millert   949: for a user on the current host, he or she will be able to run
1.9       millert   950: \&\f(CW\*(C`sudo \-l\*(C'\fR without a password.  Additionally, a user may only run
                    951: \&\f(CW\*(C`sudo \-v\*(C'\fR without a password if the \f(CW\*(C`NOPASSWD\*(C'\fR tag is present
1.3       millert   952: for all a user's entries that pertain to the current host.
                    953: This behavior may be overridden via the verifypw and listpw options.
1.17      millert   954: .PP
                    955: \fI\s-1NOEXEC\s0 and \s-1EXEC\s0\fR
                    956: .IX Subsection "NOEXEC and EXEC"
                    957: .PP
                    958: If sudo has been compiled with \fInoexec\fR support and the underlying
                    959: operating system support it, the \f(CW\*(C`NOEXEC\*(C'\fR tag can be used to prevent
                    960: a dynamically-linked executable from running further commands itself.
                    961: .PP
                    962: In the following example, user \fBaaron\fR may run \fI/usr/bin/more\fR
                    963: and \fI/usr/bin/vi\fR but shell escapes will be disabled.
                    964: .PP
                    965: .Vb 1
                    966: \& aaron  shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
                    967: .Ve
                    968: .PP
                    969: See the \*(L"\s-1PREVENTING\s0 \s-1SHELL\s0 \s-1ESCAPES\s0\*(R" section below for more details
                    970: on how \fInoexec\fR works and whether or not it will work on your system.
                    971: .Sh "Wildcards"
                    972: .IX Subsection "Wildcards"
                    973: \&\fBsudo\fR allows shell-style \fIwildcards\fR (aka meta or glob characters)
                    974: to be used in pathnames as well as command line arguments in the
                    975: \&\fIsudoers\fR file.  Wildcard matching is done via the \fB\s-1POSIX\s0\fR
                    976: \&\fIfnmatch\fR\|(3) routine.  Note that these are \fInot\fR regular expressions.
1.15      millert   977: .ie n .IP "\*(C`*\*(C'" 8
                    978: .el .IP "\f(CW\*(C`*\*(C'\fR" 8
1.9       millert   979: .IX Item "*"
1.1       millert   980: Matches any set of zero or more characters.
1.15      millert   981: .ie n .IP "\*(C`?\*(C'" 8
                    982: .el .IP "\f(CW\*(C`?\*(C'\fR" 8
1.9       millert   983: .IX Item "?"
1.1       millert   984: Matches any single character.
1.15      millert   985: .ie n .IP "\*(C`[...]\*(C'" 8
                    986: .el .IP "\f(CW\*(C`[...]\*(C'\fR" 8
1.9       millert   987: .IX Item "[...]"
1.1       millert   988: Matches any character in the specified range.
1.15      millert   989: .ie n .IP "\*(C`[!...]\*(C'" 8
                    990: .el .IP "\f(CW\*(C`[!...]\*(C'\fR" 8
1.9       millert   991: .IX Item "[!...]"
1.1       millert   992: Matches any character \fBnot\fR in the specified range.
1.15      millert   993: .ie n .IP "\*(C`\ex\*(C'" 8
                    994: .el .IP "\f(CW\*(C`\ex\*(C'\fR" 8
1.9       millert   995: .IX Item "x"
1.1       millert   996: For any character \*(L"x\*(R", evaluates to \*(L"x\*(R".  This is used to
                    997: escape special characters such as: \*(L"*\*(R", \*(L"?\*(R", \*(L"[\*(R", and \*(L"}\*(R".
                    998: .PP
                    999: Note that a forward slash ('/') will \fBnot\fR be matched by
                   1000: wildcards used in the pathname.  When matching the command
1.13      jmc      1001: line arguments, however, a slash \fBdoes\fR get matched by
1.1       millert  1002: wildcards.  This is to make a path like:
                   1003: .PP
                   1004: .Vb 1
                   1005: \&    /usr/bin/*
                   1006: .Ve
1.15      millert  1007: .PP
1.17      millert  1008: match \fI/usr/bin/who\fR but not \fI/usr/bin/X11/xterm\fR.
                   1009: .PP
                   1010: \&\s-1WARNING:\s0 a pathname with wildcards will \fBnot\fR match a user command
                   1011: that consists of a relative path.  In other words, given the
                   1012: following \fIsudoers\fR entry:
                   1013: .PP
                   1014: .Vb 1
                   1015: \&    billy  workstation = /usr/bin/*
                   1016: .Ve
                   1017: .PP
                   1018: user billy will be able to run any command in /usr/bin as root, such
                   1019: as \fI/usr/bin/w\fR.  The following two command will be allowed (the first
                   1020: assumes that \fI/usr/bin\fR is in the user's path):
                   1021: .PP
                   1022: .Vb 2
                   1023: \&    $ sudo w
                   1024: \&    $ sudo /usr/bin/w
                   1025: .Ve
                   1026: .PP
                   1027: However, this will not:
                   1028: .PP
                   1029: .Vb 2
                   1030: \&    $ cd /usr/bin
                   1031: \&    $ sudo ./w
                   1032: .Ve
                   1033: .PP
                   1034: For this reason you should only \fBgrant\fR access to commands using
                   1035: wildcards and never \fBrestrict\fR access using them.  This limitation
                   1036: will be removed in a future version of \fBsudo\fR.
                   1037: .Sh "Exceptions to wildcard rules"
                   1038: .IX Subsection "Exceptions to wildcard rules"
1.1       millert  1039: The following exceptions apply to the above rules:
1.15      millert  1040: .ie n .IP """""" 8
                   1041: .el .IP "\f(CW``''\fR" 8
                   1042: .IX Item """"""
                   1043: If the empty string \f(CW""\fR is the only command line argument in the
1.9       millert  1044: \&\fIsudoers\fR entry it means that command is not allowed to be run
1.1       millert  1045: with \fBany\fR arguments.
1.17      millert  1046: .Sh "Other special characters and reserved words"
                   1047: .IX Subsection "Other special characters and reserved words"
1.1       millert  1048: The pound sign ('#') is used to indicate a comment (unless it
                   1049: occurs in the context of a user name and is followed by one or
                   1050: more digits, in which case it is treated as a uid).  Both the
                   1051: comment character and any text after it, up to the end of the line,
                   1052: are ignored.
                   1053: .PP
1.16      jmc      1054: The reserved word \fB\s-1ALL\s0\fR is a built-in \fIalias\fR that always causes
1.1       millert  1055: a match to succeed.  It can be used wherever one might otherwise
1.9       millert  1056: 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.
1.1       millert  1057: You should not try to define your own \fIalias\fR called \fB\s-1ALL\s0\fR as the
1.16      jmc      1058: built-in alias will be used in preference to your own.  Please note
1.1       millert  1059: that using \fB\s-1ALL\s0\fR can be dangerous since in a command context, it
                   1060: allows the user to run \fBany\fR command on the system.
                   1061: .PP
1.9       millert  1062: An exclamation point ('!') can be used as a logical \fInot\fR operator
                   1063: both in an \fIalias\fR and in front of a \f(CW\*(C`Cmnd\*(C'\fR.  This allows one to
                   1064: exclude certain values.  Note, however, that using a \f(CW\*(C`!\*(C'\fR in
1.16      jmc      1065: conjunction with the built-in \f(CW\*(C`ALL\*(C'\fR alias to allow a user to
1.1       millert  1066: run \*(L"all but a few\*(R" commands rarely works as intended (see \s-1SECURITY\s0
1.9       millert  1067: \&\s-1NOTES\s0 below).
1.1       millert  1068: .PP
1.9       millert  1069: Long lines can be continued with a backslash ('\e') as the last
1.1       millert  1070: character on the line.
                   1071: .PP
1.7       pjanzen  1072: Whitespace between elements in a list as well as special syntactic
1.9       millert  1073: characters in a \fIUser Specification\fR ('=', ':', '(', ')') is optional.
1.1       millert  1074: .PP
1.9       millert  1075: The following characters must be escaped with a backslash ('\e') when
1.6       krw      1076: used as part of a word (e.g. a username or hostname):
1.9       millert  1077: \&'@', '!', '=', ':', ',', '(', ')', '\e'.
1.17      millert  1078: .SH "FILES"
                   1079: .IX Header "FILES"
                   1080: .Vb 3
                   1081: \& /etc/sudoers           List of who can run what
                   1082: \& /etc/group             Local groups file
                   1083: \& /etc/netgroup          List of network groups
                   1084: .Ve
1.1       millert  1085: .SH "EXAMPLES"
1.9       millert  1086: .IX Header "EXAMPLES"
1.17      millert  1087: Since the \fIsudoers\fR file is parsed in a single pass, order is
                   1088: important.  In general, you should structure \fIsudoers\fR such that
                   1089: the \f(CW\*(C`Host_Alias\*(C'\fR, \f(CW\*(C`User_Alias\*(C'\fR, and \f(CW\*(C`Cmnd_Alias\*(C'\fR specifications
                   1090: come first, followed by any \f(CW\*(C`Default_Entry\*(C'\fR lines, and finally the
                   1091: \&\f(CW\*(C`Runas_Alias\*(C'\fR and user specifications.  The basic rule of thumb
                   1092: is you cannot reference an Alias that has not already been defined.
                   1093: .PP
1.1       millert  1094: Below are example \fIsudoers\fR entries.  Admittedly, some of
                   1095: these are a bit contrived.  First, we define our \fIaliases\fR:
                   1096: .PP
                   1097: .Vb 4
                   1098: \& # User alias specification
                   1099: \& User_Alias     FULLTIMERS = millert, mikef, dowdy
                   1100: \& User_Alias     PARTTIMERS = bostley, jwfox, crawl
                   1101: \& User_Alias     WEBMASTERS = will, wendy, wim
                   1102: .Ve
1.15      millert  1103: .PP
1.1       millert  1104: .Vb 3
                   1105: \& # Runas alias specification
                   1106: \& Runas_Alias    OP = root, operator
                   1107: \& Runas_Alias    DB = oracle, sybase
                   1108: .Ve
1.15      millert  1109: .PP
1.1       millert  1110: .Vb 9
                   1111: \& # Host alias specification
                   1112: \& Host_Alias     SPARC = bigtime, eclipse, moet, anchor :\e
                   1113: \&                SGI = grolsch, dandelion, black :\e
                   1114: \&                ALPHA = widget, thalamus, foobar :\e
                   1115: \&                HPPA = boa, nag, python
                   1116: \& Host_Alias     CUNETS = 128.138.0.0/255.255.0.0
                   1117: \& Host_Alias     CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
                   1118: \& Host_Alias     SERVERS = master, mail, www, ns
                   1119: \& Host_Alias     CDROM = orion, perseus, hercules
                   1120: .Ve
1.15      millert  1121: .PP
1.1       millert  1122: .Vb 12
                   1123: \& # Cmnd alias specification
                   1124: \& Cmnd_Alias     DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\e
                   1125: \&                        /usr/sbin/restore, /usr/sbin/rrestore
                   1126: \& Cmnd_Alias     KILL = /usr/bin/kill
                   1127: \& Cmnd_Alias     PRINTING = /usr/sbin/lpc, /usr/bin/lprm
                   1128: \& Cmnd_Alias     SHUTDOWN = /usr/sbin/shutdown
1.17      millert  1129: \& Cmnd_Alias     HALT = /usr/sbin/halt
                   1130: \& Cmnd_Alias     REBOOT = /usr/sbin/reboot
1.1       millert  1131: \& Cmnd_Alias     SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh, \e
                   1132: \&                         /usr/local/bin/tcsh, /usr/bin/rsh, \e
                   1133: \&                         /usr/local/bin/zsh
                   1134: \& Cmnd_Alias     SU = /usr/bin/su
                   1135: .Ve
1.15      millert  1136: .PP
1.1       millert  1137: Here we override some of the compiled in default values.  We want
1.15      millert  1138: \&\fBsudo\fR to log via \fIsyslog\fR\|(3) using the \fIauth\fR facility in all
                   1139: cases.  We don't want to subject the full time staff to the \fBsudo\fR
                   1140: lecture, user \fBmillert\fR need not give a password, and we don't
1.17      millert  1141: want to reset the \f(CW\*(C`LOGNAME\*(C'\fR or \f(CW\*(C`USER\*(C'\fR environment variables when
1.15      millert  1142: running commands as root.  Additionally, on the machines in the
                   1143: \&\fI\s-1SERVERS\s0\fR \f(CW\*(C`Host_Alias\*(C'\fR, we keep an additional local log file and
                   1144: make sure we log the year in each log line since the log entries
                   1145: will be kept around for several years.
1.1       millert  1146: .PP
1.15      millert  1147: .Vb 6
1.16      jmc      1148: \& # Override built-in defaults
1.1       millert  1149: \& Defaults               syslog=auth
1.15      millert  1150: \& Defaults>root          !set_logname
1.1       millert  1151: \& Defaults:FULLTIMERS    !lecture
                   1152: \& Defaults:millert       !authenticate
                   1153: \& Defaults@SERVERS       log_year, logfile=/var/log/sudo.log
                   1154: .Ve
1.15      millert  1155: .PP
1.1       millert  1156: The \fIUser specification\fR is the part that actually determines who may
                   1157: run what.
                   1158: .PP
                   1159: .Vb 2
                   1160: \& root           ALL = (ALL) ALL
                   1161: \& %wheel         ALL = (ALL) ALL
                   1162: .Ve
1.15      millert  1163: .PP
1.1       millert  1164: We let \fBroot\fR and any user in group \fBwheel\fR run any command on any
                   1165: host as any user.
                   1166: .PP
                   1167: .Vb 1
                   1168: \& FULLTIMERS     ALL = NOPASSWD: ALL
                   1169: .Ve
1.15      millert  1170: .PP
1.1       millert  1171: Full time sysadmins (\fBmillert\fR, \fBmikef\fR, and \fBdowdy\fR) may run any
                   1172: command on any host without authenticating themselves.
                   1173: .PP
                   1174: .Vb 1
                   1175: \& PARTTIMERS     ALL = ALL
                   1176: .Ve
1.15      millert  1177: .PP
1.1       millert  1178: Part time sysadmins (\fBbostley\fR, \fBjwfox\fR, and \fBcrawl\fR) may run any
                   1179: command on any host but they must authenticate themselves first
1.9       millert  1180: (since the entry lacks the \f(CW\*(C`NOPASSWD\*(C'\fR tag).
1.1       millert  1181: .PP
                   1182: .Vb 1
                   1183: \& jack           CSNETS = ALL
                   1184: .Ve
1.15      millert  1185: .PP
1.9       millert  1186: The user \fBjack\fR may run any command on the machines in the \fI\s-1CSNETS\s0\fR alias
1.15      millert  1187: (the networks \f(CW128.138.243.0\fR, \f(CW128.138.204.0\fR, and \f(CW128.138.242.0\fR).
                   1188: Of those networks, only \f(CW128.138.204.0\fR has an explicit netmask (in
1.9       millert  1189: \&\s-1CIDR\s0 notation) indicating it is a class C network.  For the other
                   1190: networks in \fI\s-1CSNETS\s0\fR, the local machine's netmask will be used
1.1       millert  1191: during matching.
                   1192: .PP
                   1193: .Vb 1
                   1194: \& lisa           CUNETS = ALL
                   1195: .Ve
1.15      millert  1196: .PP
1.9       millert  1197: The user \fBlisa\fR may run any command on any host in the \fI\s-1CUNETS\s0\fR alias
1.15      millert  1198: (the class B network \f(CW128.138.0.0\fR).
1.1       millert  1199: .PP
                   1200: .Vb 2
1.17      millert  1201: \& operator       ALL = DUMPS, KILL, SHUTDOWN, HALT, REBOOT, PRINTING,\e
                   1202: \&                sudoedit /etc/printcap, /usr/oper/bin/
1.1       millert  1203: .Ve
1.15      millert  1204: .PP
1.1       millert  1205: The \fBoperator\fR user may run commands limited to simple maintenance.
                   1206: Here, those are commands related to backups, killing processes, the
                   1207: printing system, shutting down the system, and any commands in the
                   1208: directory \fI/usr/oper/bin/\fR.
                   1209: .PP
                   1210: .Vb 1
                   1211: \& joe            ALL = /usr/bin/su operator
                   1212: .Ve
1.15      millert  1213: .PP
1.1       millert  1214: The user \fBjoe\fR may only \fIsu\fR\|(1) to operator.
                   1215: .PP
                   1216: .Vb 1
                   1217: \& pete           HPPA = /usr/bin/passwd [A-z]*, !/usr/bin/passwd root
                   1218: .Ve
1.15      millert  1219: .PP
1.1       millert  1220: The user \fBpete\fR is allowed to change anyone's password except for
1.9       millert  1221: root on the \fI\s-1HPPA\s0\fR machines.  Note that this assumes \fIpasswd\fR\|(1)
1.1       millert  1222: does not take multiple usernames on the command line.
                   1223: .PP
                   1224: .Vb 1
                   1225: \& bob            SPARC = (OP) ALL : SGI = (OP) ALL
                   1226: .Ve
1.15      millert  1227: .PP
1.9       millert  1228: The user \fBbob\fR may run anything on the \fI\s-1SPARC\s0\fR and \fI\s-1SGI\s0\fR machines
                   1229: as any user listed in the \fI\s-1OP\s0\fR \f(CW\*(C`Runas_Alias\*(C'\fR (\fBroot\fR and \fBoperator\fR).
1.1       millert  1230: .PP
                   1231: .Vb 1
                   1232: \& jim            +biglab = ALL
                   1233: .Ve
1.15      millert  1234: .PP
1.1       millert  1235: The user \fBjim\fR may run any command on machines in the \fIbiglab\fR netgroup.
1.9       millert  1236: \&\fBSudo\fR knows that \*(L"biglab\*(R" is a netgroup due to the '+' prefix.
1.1       millert  1237: .PP
                   1238: .Vb 1
                   1239: \& +secretaries   ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser
                   1240: .Ve
1.15      millert  1241: .PP
1.1       millert  1242: Users in the \fBsecretaries\fR netgroup need to help manage the printers
                   1243: as well as add and remove users, so they are allowed to run those
                   1244: commands on all machines.
                   1245: .PP
                   1246: .Vb 1
                   1247: \& fred           ALL = (DB) NOPASSWD: ALL
                   1248: .Ve
1.15      millert  1249: .PP
1.9       millert  1250: The user \fBfred\fR can run commands as any user in the \fI\s-1DB\s0\fR \f(CW\*(C`Runas_Alias\*(C'\fR
1.1       millert  1251: (\fBoracle\fR or \fBsybase\fR) without giving a password.
                   1252: .PP
                   1253: .Vb 1
                   1254: \& john           ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*
                   1255: .Ve
1.15      millert  1256: .PP
1.9       millert  1257: On the \fI\s-1ALPHA\s0\fR machines, user \fBjohn\fR may su to anyone except root
1.1       millert  1258: but he is not allowed to give \fIsu\fR\|(1) any flags.
                   1259: .PP
                   1260: .Vb 1
                   1261: \& jen            ALL, !SERVERS = ALL
                   1262: .Ve
1.15      millert  1263: .PP
1.1       millert  1264: The user \fBjen\fR may run any command on any machine except for those
1.9       millert  1265: in the \fI\s-1SERVERS\s0\fR \f(CW\*(C`Host_Alias\*(C'\fR (master, mail, www and ns).
1.1       millert  1266: .PP
                   1267: .Vb 1
                   1268: \& jill           SERVERS = /usr/bin/, !SU, !SHELLS
                   1269: .Ve
1.15      millert  1270: .PP
1.9       millert  1271: For any machine in the \fI\s-1SERVERS\s0\fR \f(CW\*(C`Host_Alias\*(C'\fR, \fBjill\fR may run
1.1       millert  1272: any commands in the directory /usr/bin/ except for those commands
1.9       millert  1273: belonging to the \fI\s-1SU\s0\fR and \fI\s-1SHELLS\s0\fR \f(CW\*(C`Cmnd_Aliases\*(C'\fR.
1.1       millert  1274: .PP
                   1275: .Vb 1
                   1276: \& steve          CSNETS = (operator) /usr/local/op_commands/
                   1277: .Ve
1.15      millert  1278: .PP
1.1       millert  1279: The user \fBsteve\fR may run any command in the directory /usr/local/op_commands/
                   1280: but only as user operator.
                   1281: .PP
                   1282: .Vb 1
                   1283: \& matt           valkyrie = KILL
                   1284: .Ve
1.15      millert  1285: .PP
1.1       millert  1286: On his personal workstation, valkyrie, \fBmatt\fR needs to be able to
                   1287: kill hung processes.
                   1288: .PP
                   1289: .Vb 1
                   1290: \& WEBMASTERS     www = (www) ALL, (root) /usr/bin/su www
                   1291: .Ve
1.15      millert  1292: .PP
1.9       millert  1293: On the host www, any user in the \fI\s-1WEBMASTERS\s0\fR \f(CW\*(C`User_Alias\*(C'\fR (will,
1.1       millert  1294: wendy, and wim), may run any command as user www (which owns the
                   1295: web pages) or simply \fIsu\fR\|(1) to www.
                   1296: .PP
                   1297: .Vb 2
                   1298: \& ALL            CDROM = NOPASSWD: /sbin/umount /CDROM,\e
                   1299: \&                /sbin/mount -o nosuid\e,nodev /dev/cd0a /CDROM
                   1300: .Ve
1.15      millert  1301: .PP
                   1302: Any user may mount or unmount a CD-ROM on the machines in the \s-1CDROM\s0
1.9       millert  1303: \&\f(CW\*(C`Host_Alias\*(C'\fR (orion, perseus, hercules) without entering a password.
1.7       pjanzen  1304: This is a bit tedious for users to type, so it is a prime candidate
1.1       millert  1305: for encapsulating in a shell script.
                   1306: .SH "SECURITY NOTES"
1.9       millert  1307: .IX Header "SECURITY NOTES"
                   1308: It is generally not effective to \*(L"subtract\*(R" commands from \f(CW\*(C`ALL\*(C'\fR
                   1309: using the '!' operator.  A user can trivially circumvent this
1.1       millert  1310: by copying the desired command to a different name and then
                   1311: executing that.  For example:
                   1312: .PP
                   1313: .Vb 1
                   1314: \&    bill        ALL = ALL, !SU, !SHELLS
                   1315: .Ve
1.15      millert  1316: .PP
1.1       millert  1317: Doesn't really prevent \fBbill\fR from running the commands listed in
1.9       millert  1318: \&\fI\s-1SU\s0\fR or \fI\s-1SHELLS\s0\fR since he can simply copy those commands to a
1.1       millert  1319: different name, or use a shell escape from an editor or other
                   1320: program.  Therefore, these kind of restrictions should be considered
                   1321: advisory at best (and reinforced by policy).
1.17      millert  1322: .SH "PREVENTING SHELL ESCAPES"
                   1323: .IX Header "PREVENTING SHELL ESCAPES"
                   1324: Once \fBsudo\fR executes a program, that program is free to do whatever
                   1325: it pleases, including run other programs.  This can be a security
                   1326: issue since it is not uncommon for a program to allow shell escapes,
                   1327: which lets a user bypass \fBsudo\fR's restrictions.  Common programs
                   1328: that permit shell escapes include shells (obviously), editors,
                   1329: paginators, mail and terminal programs.
                   1330: .PP
                   1331: Many systems that support shared libraries have the ability to
                   1332: override default library functions by pointing an environment
                   1333: variable (usually \f(CW\*(C`LD_PRELOAD\*(C'\fR) to an alternate shared library.
                   1334: On such systems, \fBsudo\fR's \fInoexec\fR functionality can be used to
                   1335: prevent a program run by sudo from executing any other programs.
                   1336: Note, however, that this applies only to native dynamically-linked
                   1337: executables.  Statically-linked executables and foreign executables
                   1338: running under binary emulation are not affected.
                   1339: .PP
                   1340: To tell whether or not \fBsudo\fR supports \fInoexec\fR, you can run
                   1341: the following as root:
                   1342: .PP
                   1343: .Vb 1
                   1344: \&    sudo -V | grep "dummy exec"
                   1345: .Ve
                   1346: .PP
                   1347: If the resulting output contains a line that begins with:
                   1348: .PP
                   1349: .Vb 1
                   1350: \&    File containing dummy exec functions:
                   1351: .Ve
                   1352: .PP
                   1353: then \fBsudo\fR may be able to replace the exec family of functions
                   1354: in the standard library with its own that simply return an error.
                   1355: Unfortunately, there is no foolproof way to know whether or not
                   1356: \&\fInoexec\fR will work at compile\-time.  \fINoexec\fR should work on
                   1357: SunOS, Solaris, *BSD, Linux, \s-1IRIX\s0, Tru64 \s-1UNIX\s0, MacOS X, and HP-UX
                   1358: 11.x.  It is known \fBnot\fR to work on \s-1AIX\s0 and UnixWare.  \fINoexec\fR
                   1359: is expected to work on most operating systems that support the
                   1360: \&\f(CW\*(C`LD_PRELOAD\*(C'\fR environment variable.  Check your operating system's
                   1361: manual pages for the dynamic linker (usually ld.so, ld.so.1, dyld,
                   1362: dld.sl, rld, or loader) to see if \f(CW\*(C`LD_PRELOAD\*(C'\fR is supported.
                   1363: .PP
                   1364: To enable \fInoexec\fR for a command, use the \f(CW\*(C`NOEXEC\*(C'\fR tag as documented
                   1365: in the User Specification section above.  Here is that example again:
                   1366: .PP
                   1367: .Vb 1
                   1368: \& aaron  shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
                   1369: .Ve
                   1370: .PP
                   1371: This allows user \fBaaron\fR to run \fI/usr/bin/more\fR and \fI/usr/bin/vi\fR
                   1372: with \fInoexec\fR enabled.  This will prevent those two commands from
                   1373: executing other commands (such as a shell).  If you are unsure
                   1374: whether or not your system is capable of supporting \fInoexec\fR you
                   1375: can always just try it out and see if it works.
                   1376: .PP
                   1377: Note that disabling shell escapes is not a panacea.  Programs running
                   1378: as root are still capable of many potentially hazardous operations
                   1379: (such as changing or overwriting files) that could lead to unintended
                   1380: privilege escalation.  In the specific case of an editor, a safer
                   1381: approach is to give the user permission to run \fBsudoedit\fR.
                   1382: .SH "SEE ALSO"
                   1383: .IX Header "SEE ALSO"
                   1384: \&\fIrsh\fR\|(1), \fIsu\fR\|(1), \fIfnmatch\fR\|(3), sudo(8), visudo(8)
1.1       millert  1385: .SH "CAVEATS"
1.9       millert  1386: .IX Header "CAVEATS"
1.1       millert  1387: The \fIsudoers\fR file should \fBalways\fR be edited by the \fBvisudo\fR
                   1388: command which locks the file and does grammatical checking. It is
                   1389: imperative that \fIsudoers\fR be free of syntax errors since \fBsudo\fR
                   1390: will not run with a syntactically incorrect \fIsudoers\fR file.
1.3       millert  1391: .PP
                   1392: When using netgroups of machines (as opposed to users), if you
1.5       millert  1393: store fully qualified hostnames in the netgroup (as is usually the
                   1394: case), you either need to have the machine's hostname be fully qualified
1.9       millert  1395: as returned by the \f(CW\*(C`hostname\*(C'\fR command or use the \fIfqdn\fR option in
                   1396: \&\fIsudoers\fR.
1.17      millert  1397: .SH "BUGS"
                   1398: .IX Header "BUGS"
                   1399: If you feel you have found a bug in \fBsudo\fR, please submit a bug report
                   1400: at http://www.sudo.ws/sudo/bugs/
                   1401: .SH "SUPPORT"
                   1402: .IX Header "SUPPORT"
                   1403: Commercial support is available for \fBsudo\fR, see
                   1404: http://www.sudo.ws/sudo/support.html for details.
                   1405: .PP
                   1406: Limited free support is available via the sudo-users mailing list,
                   1407: see http://www.sudo.ws/mailman/listinfo/sudo\-users to subscribe or
                   1408: search the archives.
                   1409: .SH "DISCLAIMER"
                   1410: .IX Header "DISCLAIMER"
                   1411: \&\fBSudo\fR is provided ``\s-1AS\s0 \s-1IS\s0'' and any express or implied warranties,
                   1412: including, but not limited to, the implied warranties of merchantability
                   1413: and fitness for a particular purpose are disclaimed.  See the \s-1LICENSE\s0
                   1414: file distributed with \fBsudo\fR or http://www.sudo.ws/sudo/license.html
                   1415: for complete details.