[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.4

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