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

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