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

1.1       millert     1: .rn '' }`
1.5     ! millert     2: ''' $RCSfile: sudoers.man.in,v $$Revision: 1.5 $$Date: 2000/03/27 03:26:23 $
1.2       aaron       3: '''
1.5     ! millert     4: ''' $Log: sudoers.man.in,v $
        !             5: ''' Revision 1.5  2000/03/27 03:26:23  millert
        !             6: ''' Use 8 and 5 in the man page bodies as well.
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.5     ! millert    99: .TH sudoers 5 "1.6.3" "26/Mar/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.
1.5     ! millert   318: 255.255.255.0) or \s-1CIDR\s0 notation (number of bits, eg. 24).  A hostname
        !           319: may include shell-style wildcards (see `Wildcards\*(R' section below),
        !           320: but unless the \f(CWhostname\fR command on your machine returns the fully
        !           321: qualified hostname, you'll need to use the \fIfqdn\fR option for wildcards
        !           322: to be useful.
1.1       millert   323: .PP
                    324: .Vb 2
                    325: \& Cmnd_List ::= Cmnd |
                    326: \&               Cmnd ',' Cmnd_List
                    327: .Ve
                    328: .Vb 3
                    329: \& commandname ::= filename |
                    330: \&                 filename args |
                    331: \&                 filename '""'
                    332: .Ve
                    333: .Vb 3
                    334: \& Cmnd ::= '!'* commandname |
                    335: \&          '!'* directory |
                    336: \&          '!'* Cmnd_Alias
                    337: .Ve
                    338: A \f(CWCmnd_List\fR is a list of one or more commandnames, directories, and other
1.5     ! millert   339: aliases.  A commandname is a fully qualified filename which may include
1.1       millert   340: shell-style wildcards (see `Wildcards\*(R' section below).  A simple
                    341: filename allows the user to run the command with any arguments he/she
                    342: wishes.  However, you may also command line arguments (including wildcards).
                    343: Alternately, you can specify \f(CW""\fR to indicate that the command
                    344: may only be run \fBwithout\fR command line arguments.  A directory is a
                    345: fully qualified pathname ending in a \*(L'/\*(R'.  When you specify a directory
                    346: in a \f(CWCmnd_List\fR, the user will be able to run any file within that directory
                    347: (but not in any subdirectories therein).
                    348: .PP
                    349: If a \f(CWCmnd\fR has associated command line arguments, then the arguments
                    350: in the \f(CWCmnd\fR must match exactly those given by the user on the command line
                    351: (or match the wildcards if there are any).  Note that the following
                    352: characters must be escaped with a \*(L'\e\*(R' if they are used in command
                    353: arguments: \*(L',\*(R', \*(L':\*(R', \*(L'=\*(R', \*(L'\e\*(R'.
                    354: .Sh "Defaults"
                    355: Certain configuration options may be changed from their default
                    356: values at runtime via one or more \f(CWDefault_Entry\fR lines.  These
                    357: may affect all users on any host, all users on a specific host,
                    358: or just a specific user.  When multiple entries match, they are
                    359: applied in order.  Where there are conflicting values, the last
                    360: value on a matching line takes effect.
                    361: .PP
                    362: .Vb 3
                    363: \& Default_Type ::= 'Defaults' ||
                    364: \&                  'Defaults' ':' User ||
                    365: \&                  'Defaults' '@' Host
                    366: .Ve
                    367: .Vb 1
                    368: \& Default_Entry ::= Default_Type Parameter_List
                    369: .Ve
                    370: .Vb 2
                    371: \& Parameter ::= Parameter '=' Value ||
                    372: \&               '!'* Parameter ||
                    373: .Ve
                    374: Parameters may be \fBflags\fR, \fBinteger\fR values, or \fBstrings\fR.  Flags
                    375: are implicitly boolean and can be turned off via the \*(L'!\*(R' operator.
                    376: Some integer and string parameters may also be used in a boolean
                    377: context to disable them.  Values may be enclosed in double quotes
                    378: (\f(CW"\fR) when they contain multiple words.  Special characters may
                    379: be escaped with a backslash (\f(CW\e\fR).
                    380: .PP
                    381: \fBFlags\fR:
                    382: .Ip "long_otp_prompt" 12
1.4       millert   383: When validating with a One Time Password scheme (\fBS/Key\fR or \fB\s-1OPIE\s0\fR),
                    384: a two-line prompt is used to make it easier to cut and paste the
                    385: challenge to a local window.  It's not as pretty as the default but
                    386: some people find it more convenient.  This flag is off by default.
1.1       millert   387: .Ip "ignore_dot" 12
1.4       millert   388: If set, \fBsudo\fR will ignore \*(L'.\*(R' or \*(L'\*(R' (current dir) in \f(CW$PATH\fR;
                    389: the \f(CW$PATH\fR itself is not modified.  This flag is off by default.
1.1       millert   390: .Ip "mail_always" 12
1.5     ! millert   391: Send mail to the \fImailto\fR user every time a users runs \fBsudo\fR.
1.4       millert   392: This flag is off by default.
1.1       millert   393: .Ip "mail_no_user" 12
1.4       millert   394: If set, mail will be sent to the \fImailto\fR user if the invoking
                    395: user is not in the \fIsudoers\fR file.  This flag is on by default.
1.1       millert   396: .Ip "mail_no_host" 12
1.4       millert   397: If set, mail will be sent to the \fImailto\fR user if the invoking
                    398: user exists in the \fIsudoers\fR file, but is not allowed to run
                    399: commands on the current host.  This flag is off by default.
1.1       millert   400: .Ip "mail_no_perms" 12
1.4       millert   401: If set, mail will be sent to the \fImailto\fR user if the invoking
1.5     ! millert   402: user allowed to use \fBsudo\fR but the command they are trying is not
1.4       millert   403: listed in their \fIsudoers\fR file entry.  This flag is off by default.
1.1       millert   404: .Ip "tty_tickets" 12
1.4       millert   405: If set, users must authenticate on a per-tty basis.  Normally,
                    406: \fBsudo\fR uses a directory in the ticket dir with the same name as
                    407: the user running it.  With this flag enabled, \fBsudo\fR will use a
                    408: file named for the tty the user is logged in on in that directory.
                    409: This flag is off by default.
1.1       millert   410: .Ip "lecture" 12
1.4       millert   411: If set, a user will receive a short lecture the first time he/she
                    412: runs \fBsudo\fR.  This flag is on by default.
1.1       millert   413: .Ip "authenticate" 12
1.4       millert   414: If set, users must authenticate themselves via a password (or other
                    415: means of authentication) before they may run commands.  This default
                    416: may be overridden via the \f(CWPASSWD\fR and \f(CWNOPASSWD\fR tags.
                    417: This flag is on by default.
1.1       millert   418: .Ip "root_sudo" 12
1.5     ! millert   419: If set, root is allowed to run \fBsudo\fR too.  Disabling this prevents users
        !           420: from \*(L"chaining\*(R" \fBsudo\fR commands to get a root shell by doing something
1.4       millert   421: like \f(CW"sudo sudo /bin/sh"\fR.
                    422: This flag is on by default.
1.1       millert   423: .Ip "log_host" 12
1.4       millert   424: If set, the hostname will be logged in the (non-syslog) \fBsudo\fR log file.
                    425: This flag is off by default.
1.1       millert   426: .Ip "log_year" 12
1.4       millert   427: If set, the four-digit year will be logged in the (non-syslog) \fBsudo\fR log file.
                    428: This flag is off by default.
1.1       millert   429: .Ip "shell_noargs" 12
1.4       millert   430: If set and \fBsudo\fR is invoked with no arguments it acts as if the
                    431: \f(CW-s\fR flag had been given.  That is, it runs a shell as root (the
                    432: shell is determined by the \f(CWSHELL\fR environment variable if it is
                    433: set, falling back on the shell listed in the invoking user's
                    434: /etc/passwd entry if not).  This flag is off by default.
1.1       millert   435: .Ip "set_home" 12
1.4       millert   436: If set and \fBsudo\fR is invoked with the \f(CW-s\fR flag the \f(CWHOME\fR
                    437: environment variable will be set to the home directory of the target
                    438: user (which is root unless the \f(CW-u\fR option is used).  This effectively
                    439: makes the \f(CW-s\fR flag imply \f(CW-H\fR.  This flag is off by default.
1.1       millert   440: .Ip "path_info" 12
1.4       millert   441: Normally, \fBsudo\fR will tell the user when a command could not be
                    442: found in their \f(CW$PATH\fR.  Some sites may wish to disable this as
                    443: it could be used to gather information on the location of executables
                    444: that the normal user does not have access to.  The disadvantage is
                    445: that if the executable is simply not in the user's \f(CW$PATH\fR, \fBsudo\fR
                    446: will tell the user that they are not allowed to run it, which can
                    447: be confusing.  This flag is off by default.
1.1       millert   448: .Ip "fqdn" 12
1.4       millert   449: Set this flag if you want to put fully qualified hostnames in the
                    450: \fIsudoers\fR file.  Ie: instead of myhost you would use myhost.mydomain.edu.
                    451: You may still use the short form if you wish (and even mix the two).
1.5     ! millert   452: Beware that turning on \fIfqdn\fR requires \fBsudo\fR to make \s-1DNS\s0 lookups
1.4       millert   453: which may make \fBsudo\fR unusable if \s-1DNS\s0 stops working (for example
                    454: if the machine is not plugged into the network).  Also note that
                    455: you must use the host's official name as \s-1DNS\s0 knows it.  That is,
                    456: you may not use a host alias (\f(CWCNAME\fR entry) due to performance
                    457: issues and the fact that there is no way to get all aliases from
                    458: \s-1DNS\s0.  If your machine's hostname (as returned by the \f(CWhostname\fR
                    459: command) is already fully qualified you shouldn't need to set
                    460: \fIfqfn\fR.  This flag is off by default.
1.1       millert   461: .Ip "insults" 12
1.5     ! millert   462: If set, \fBsudo\fR will insult users when they enter an incorrect
1.4       millert   463: password.  This flag is off by default.
1.1       millert   464: .Ip "requiretty" 12
1.5     ! millert   465: If set, \fBsudo\fR will only run when the user is logged in to a real
1.4       millert   466: tty.  This will disallow things like \f(CW"rsh somehost sudo ls"\fR since
                    467: \fIrsh\fR\|(1) does not allocate a tty.  Because it is not possible to turn
                    468: of echo when there is no tty present, some sites may with to set
                    469: this flag to prevent a user from entering a visible password.  This
                    470: flag is off by default.
1.5     ! millert   471: .Ip "env_editor" 12
        !           472: If set, \fBvisudo\fR will use the value of the \s-1EDITOR\s0 or \s-1VISUAL\s0 environment
        !           473: falling back on the default editor.  Note that this may create a
        !           474: security hole as most editors allow a user to get a shell (which
        !           475: would be a root shell and not be logged).
        !           476: .Ip "rootpw" 12
        !           477: If set, \fBsudo\fR will prompt for the root password instead of the password
        !           478: of the invoking user.
        !           479: .Ip "runaspw" 12
        !           480: If set, \fBsudo\fR will prompt for the password of the user defined by the
        !           481: \fIrunas_default\fR option (defaults to root) instead of the password
        !           482: of the invoking user.
        !           483: .Ip "targetpw" 12
        !           484: If set, \fBsudo\fR will prompt for the password of the user specified by
        !           485: the \f(CW-u\fR flag (defaults to root) instead of the password of the
        !           486: invoking user.
        !           487: .Ip "set_logname" 12
        !           488: Normally, \fBsudo\fR will set the \f(CWLOGNAME\fR and \f(CWUSER\fR environment variables
        !           489: to the name of the target user (usually root unless the \f(CW-u\fR flag is given).
        !           490: However, since some programs (including the \s-1RCS\s0 revision control system)
        !           491: use \f(CWLOGNAME\fR to determine the real identity of the user, it may be desirable
        !           492: to change this behavior.  This can be done by negating the set_logname option.
1.1       millert   493: .PP
                    494: \fBIntegers\fR:
                    495: .Ip "passwd_tries" 12
1.4       millert   496: The number of tries a user gets to enter his/her password before
1.5     ! millert   497: \fBsudo\fR logs the failure and exits.  The default is 3.
1.1       millert   498: .PP
                    499: \fBIntegers that can be used in a boolean context\fR:
                    500: .Ip "loglinelen" 12
1.4       millert   501: Number of characters per line for the file log.  This value is used
                    502: to decide when to wrap lines for nicer log files.  This has no
                    503: effect on the syslog log file, only the file log.  The default is
                    504: 80 (use 0 or negate to disable word wrap).
1.1       millert   505: .Ip "timestamp_timeout" 12
1.4       millert   506: Number of minutes that can elapse before \fBsudo\fR will ask for a passwd
                    507: again.  The default is 5, set this to 0 to always prompt for a password.
1.1       millert   508: .Ip "passwd_timeout" 12
1.5     ! millert   509: Number of minutes before the \fBsudo\fR password prompt times out.
1.4       millert   510: The default is 5, set this to 0 for no password timeout.
1.1       millert   511: .Ip "umask" 12
1.4       millert   512: Umask to use when running the root command.  Set this to 0777 to
                    513: not override the user's umask.  The default is 0022.
1.1       millert   514: .PP
                    515: \fBStrings\fR:
                    516: .Ip "mailsub" 12
1.4       millert   517: Subject of the mail sent to the \fImailto\fR user. The escape \f(CW%h\fR
                    518: will expand to the hostname of the machine.
                    519: Default is \*(L"*** \s-1SECURITY\s0 information for \f(CW%h\fR ***\*(R".
1.1       millert   520: .Ip "badpass_message" 12
1.4       millert   521: Message that is displayed if a user enters an incorrect password.
                    522: The default is \*(L"Sorry, try again.\*(R" unless insults are enabled.
1.1       millert   523: .Ip "timestampdir" 12
1.4       millert   524: The directory in which \fBsudo\fR stores its timestamp files.
1.5     ! millert   525: The default is \fI@\s-1TIMEDIR\s0@\fR.
1.1       millert   526: .Ip "passprompt" 12
1.4       millert   527: The default prompt to use when asking for a password; can be overridden
                    528: via the \f(CW-p\fR option or the \f(CWSUDO_PROMPT\fR environment variable. Supports
                    529: two escapes: \*(L"%u\*(R" expands to the user's login name and \*(L"%h\*(R" expands
                    530: to the local hostname.  The default value is \*(L"Password:\*(R".
1.1       millert   531: .Ip "runas_default" 12
1.4       millert   532: The default user to run commands as if the \f(CW-u\fR flag is not specified
                    533: on the command line.  This defaults to \*(L"root\*(R".
1.1       millert   534: .Ip "syslog_goodpri" 12
1.4       millert   535: Syslog priority to use when user authenticates successfully.
                    536: Defaults to \*(L"notice\*(R".
1.1       millert   537: .Ip "syslog_badpri" 12
1.4       millert   538: Syslog priority to use when user authenticates unsuccessfully.
                    539: Defaults to \*(L"alert\*(R".
1.5     ! millert   540: .Ip "editor" 12
        !           541: Path to the editor to be used by \fBvisudo\fR.  The default is the path
        !           542: to vi on your system.
1.1       millert   543: .PP
                    544: \fBStrings that can be used in a boolean context\fR:
1.5     ! millert   545: .Ip "logfile" 12
        !           546: Path to the \fBsudo\fR log file (not the syslog log file).  Setting a path
        !           547: turns on logging to a file, negating this option turns it off.
1.1       millert   548: .Ip "syslog" 12
1.4       millert   549: Syslog facility if syslog is being used for logging (negate to
                    550: disable syslog logging).  Defaults to \*(L"local2\*(R".
1.1       millert   551: .Ip "mailerpath" 12
1.4       millert   552: Path to mail program used to send warning mail.
                    553: Defaults to the path to sendmail found at configure time.
1.1       millert   554: .Ip "mailerflags" 12
1.4       millert   555: Flags to use when invoking mailer. Defaults to \f(CW-t\fR.
1.1       millert   556: .Ip "mailto" 12
1.4       millert   557: Address to send warning and erorr mail to.  Defaults to \*(L"root\*(R".
1.1       millert   558: .Ip "exempt_group" 12
1.4       millert   559: Users in this group are exempt from password and \s-1PATH\s0 requirements.
                    560: This is not set by default.
1.1       millert   561: .Ip "secure_path" 12
1.4       millert   562: Path used for every command run from \fBsudo\fR.  If you don't trust the
1.5     ! millert   563: people running \fBsudo\fR to have a sane \f(CWPATH\fR environment variable you may
1.4       millert   564: want to use this.  Another use is if you want to have the \*(L"root path\*(R"
                    565: be separate from the \*(L"user path.\*(R"  This is not set by default.
1.3       millert   566: .Ip "verifypw" 12
                    567: This option controls when a password will be required when a
1.5     ! millert   568: user runs \fBsudo\fR with the \fB\-v\fR.  It has the following possible values:
1.3       millert   569: .Sp
                    570: .Vb 3
1.4       millert   571: \&    all         All the user's I<sudoers> entries for the
1.3       millert   572: \&                current host must have the C<NOPASSWD>
                    573: \&                flag set to avoid entering a password.
                    574: .Ve
                    575: .Vb 4
1.4       millert   576: \&    any         At least one of the user's I<sudoers> entries
1.3       millert   577: \&                for the current host must have the
                    578: \&                C<NOPASSWD> flag set to avoid entering a
                    579: \&                password.
                    580: .Ve
                    581: .Vb 2
                    582: \&    never       The user need never enter a password to use
                    583: \&                the B<-v> flag.
                    584: .Ve
                    585: .Vb 2
                    586: \&    always      The user must always enter a password to use
                    587: \&                the B<-v> flag.
                    588: .Ve
                    589: The default value is `all\*(R'.
                    590: .Ip "listpw" 12
                    591: This option controls when a password will be required when a
1.5     ! millert   592: user runs \fBsudo\fR with the \fB\-l\fR.  It has the following possible values:
1.3       millert   593: .Sp
                    594: .Vb 3
1.4       millert   595: \&    all         All the user's I<sudoers> entries for the
1.3       millert   596: \&                current host must have the C<NOPASSWD>
                    597: \&                flag set to avoid entering a password.
                    598: .Ve
                    599: .Vb 4
1.4       millert   600: \&    any         At least one of the user's I<sudoers> entries
1.3       millert   601: \&                for the current host must have the
                    602: \&                C<NOPASSWD> flag set to avoid entering a
                    603: \&                password.
                    604: .Ve
                    605: .Vb 2
                    606: \&    never       The user need never enter a password to use
                    607: \&                the B<-l> flag.
                    608: .Ve
                    609: .Vb 2
                    610: \&    always      The user must always enter a password to use
                    611: \&                the B<-l> flag.
                    612: .Ve
                    613: The default value is `any\*(R'.
1.1       millert   614: .PP
1.5     ! millert   615: When logging via \fIsyslog\fR\|(3), \fBsudo\fR accepts the following values for the syslog
1.1       millert   616: facility (the value of the \fBsyslog\fR Parameter): \fBauthpriv\fR (if your \s-1OS\s0
                    617: supports it), \fBauth\fR, \fBdaemon\fR, \fBuser\fR, \fBlocal0\fR, \fBlocal1\fR, \fBlocal2\fR,
                    618: \fBlocal3\fR, \fBlocal4\fR, \fBlocal5\fR, \fBlocal6\fR, and \fBlocal7\fR.  The following
                    619: syslog priorities are supported: \fBalert\fR, \fBcrit\fR, \fBdebug\fR, \fBemerg\fR,
                    620: \fBerr\fR, \fBinfo\fR, \fBnotice\fR, and \fBwarning\fR.
                    621: .Sh "User Specification"
                    622: .PP
1.3       millert   623: .Vb 2
                    624: \& User_Spec ::= User_list Host_List '=' User_List Cmnd_Spec_List \e
                    625: \&               (':' User_Spec)*
1.1       millert   626: .Ve
                    627: .Vb 2
                    628: \& Cmnd_Spec_List ::= Cmnd_Spec |
                    629: \&                    Cmnd_Spec ',' Cmnd_Spec_List
                    630: .Ve
                    631: .Vb 1
1.3       millert   632: \& Cmnd_Spec ::= Runas_Spec? ('NOPASSWD:' | 'PASSWD:')? Cmnd
                    633: .Ve
                    634: .Vb 1
                    635: \& Runas_Spec ::= '(' Runas_List ')'
1.1       millert   636: .Ve
                    637: A \fBuser specification\fR determines which commands a user may run
                    638: (and as what user) on specified hosts.  By default, commands are
                    639: run as \fBroot\fR but this can be changed on a per-command basis.
                    640: .PP
                    641: Let's break that down into its constituent parts:
                    642: .Sh "Runas_Spec"
                    643: A \f(CWRunas_Spec\fR is simply a \f(CWRunas_List\fR (as defined above)
                    644: enclosed in a set of parentheses.  If you do not specify a
                    645: \f(CWRunas_Spec\fR in the user specification, a default \f(CWRunas_Spec\fR
                    646: of \fBroot\fR will be used.  A \f(CWRunas_Spec\fR sets the default for
                    647: commands that follow it.  What this means is that for the entry:
                    648: .PP
                    649: .Vb 1
                    650: \& dgb    boulder = (operator) /bin/ls, /bin/kill, /usr/bin/who
                    651: .Ve
                    652: The user \fBdgb\fR may run \fI/bin/ls\fR, \fI/bin/kill\fR, and
                    653: \fI/usr/bin/lprm\fR -- but only as \fBoperator\fR.  Eg.
                    654: .PP
                    655: .Vb 1
                    656: \&    sudo -u operator /bin/ls.
                    657: .Ve
                    658: It is also possible to override a \f(CWRunas_Spec\fR later on in an
                    659: entry.  If we modify the entry like so:
                    660: .PP
                    661: .Vb 1
                    662: \& dgb    boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm
                    663: .Ve
                    664: Then user \fBdgb\fR is now allowed to run \fI/bin/ls\fR as \fBoperator\fR,
                    665: but  \fI/bin/kill\fR and \fI/usr/bin/lprm\fR as \fBroot\fR.
                    666: .Sh "\s-1NOPASSWD\s0 and \s-1PASSWD\s0"
                    667: By default, \fBsudo\fR requires that a user authenticate him or herself
                    668: before running a command.  This behavior can be modified via the
                    669: \f(CWNOPASSWD\fR tag.  Like a \f(CWRunas_Spec\fR, the \f(CWNOPASSWD\fR tag sets
                    670: a default for the commands that follow it in the \f(CWCmnd_Spec_List\fR.
                    671: Conversely, the \f(CWPASSWD\fR tag can be used to reverse things.
                    672: For example:
                    673: .PP
                    674: .Vb 1
                    675: \& ray    rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
                    676: .Ve
                    677: would allow the user \fBray\fR to run \fI/bin/kill\fR, \fI/bin/ls\fR, and
                    678: \fI/usr/bin/lprm\fR as root on the machine rushmore as \fBroot\fR without
                    679: authenticating himself.  If we only want \fBray\fR to be able to
                    680: run \fI/bin/kill\fR without a password the entry would be:
                    681: .PP
                    682: .Vb 1
                    683: \& ray    rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
                    684: .Ve
1.3       millert   685: Note however, that the \f(CWPASSWD\fR tag has no effect on users who are
                    686: in the group specified by the exempt_group option.
                    687: .PP
                    688: By default, if the \f(CWNOPASSWD\fR tag is applied to any of the entries
                    689: for a user on the current host, he or she will be able to run
                    690: \f(CWsudo -l\fR without a password.  Additionally, a user may only run
                    691: \f(CWsudo -v\fR without a password if the \f(CWNOPASSWD\fR tag is present
                    692: for all a user's entries that pertain to the current host.
                    693: This behavior may be overridden via the verifypw and listpw options.
1.1       millert   694: .Sh "Wildcards (aka meta characters):"
                    695: \fBsudo\fR allows shell-style \fIwildcards\fR to be used in pathnames
                    696: as well as command line arguments in the \fIsudoers\fR file.  Wildcard
                    697: matching is done via the \fB\s-1POSIX\s0\fR \f(CWfnmatch(3)\fR routine.  Note that
                    698: these are \fInot\fR regular expressions.
                    699: .Ip "\f(CW*\fR" 8
                    700: Matches any set of zero or more characters.
                    701: .Ip "\f(CW?\fR" 8
                    702: Matches any single character.
                    703: .Ip "\f(CW[...]\fR" 8
                    704: Matches any character in the specified range.
                    705: .Ip "\f(CW[!...]\fR" 8
                    706: Matches any character \fBnot\fR in the specified range.
                    707: .Ip "\f(CW\ex\fR" 8
                    708: For any character \*(L"x\*(R", evaluates to \*(L"x\*(R".  This is used to
                    709: escape special characters such as: \*(L"*\*(R", \*(L"?\*(R", \*(L"[\*(R", and \*(L"}\*(R".
                    710: .PP
                    711: Note that a forward slash ('/') will \fBnot\fR be matched by
                    712: wildcards used in the pathname.  When matching the command
                    713: line arguments, however, as slash \fBdoes\fR get matched by
                    714: wildcards.  This is to make a path like:
                    715: .PP
                    716: .Vb 1
                    717: \&    /usr/bin/*
                    718: .Ve
                    719: match \f(CW/usr/bin/who\fR but not \f(CW/usr/bin/X11/xterm\fR.
                    720: .Sh "Exceptions to wildcard rules:"
                    721: The following exceptions apply to the above rules:
                    722: .Ip \f(CW""\fR 8
                    723: If the empty string \f(CW""\fR is the only command line argument in the
                    724: \fIsudoers\fR entry it means that command is not allowed to be run
                    725: with \fBany\fR arguments.
                    726: .Sh "Other special characters and reserved words:"
                    727: The pound sign ('#') is used to indicate a comment (unless it
                    728: occurs in the context of a user name and is followed by one or
                    729: more digits, in which case it is treated as a uid).  Both the
                    730: comment character and any text after it, up to the end of the line,
                    731: are ignored.
                    732: .PP
1.2       aaron     733: The reserved word \fB\s-1ALL\s0\fR is a built in \fIalias\fR that always causes
1.1       millert   734: a match to succeed.  It can be used wherever one might otherwise
                    735: use a \f(CWCmnd_Alias\fR, \f(CWUser_Alias\fR, \f(CWRunas_Alias\fR, or \f(CWHost_Alias\fR.
                    736: You should not try to define your own \fIalias\fR called \fB\s-1ALL\s0\fR as the
                    737: built in alias will be used in preference to your own.  Please note
                    738: that using \fB\s-1ALL\s0\fR can be dangerous since in a command context, it
                    739: allows the user to run \fBany\fR command on the system.
                    740: .PP
                    741: An exclamation point (\*(R'!') can be used as a logical \fInot\fR operator
                    742: both in an \fIalias\fR and in front of a \f(CWCmnd\fR.  This allows one to
                    743: exclude certain values.  Note, however, that using a \f(CW!\fR in
                    744: conjunction with the built in \f(CWALL\fR alias to allow a user to
                    745: run \*(L"all but a few\*(R" commands rarely works as intended (see \s-1SECURITY\s0
                    746: \s-1NOTES\s0 below).
                    747: .PP
                    748: Long lines can be continued with a backslash (\*(R'\e') as the last
                    749: character on the line.
                    750: .PP
                    751: Whitespace between elements in a list as well as specicial syntactic
                    752: characters in a \fIUser Specification\fR ('=\*(R', \*(L':\*(R', \*(L'(\*(R', \*(L')') is optional.
                    753: .PP
                    754: The following characters must be escaped with a backslash (\*(R'\e') when
                    755: used as part of a word (eg. a username or hostname):
                    756: \&'@\*(R', \*(L'!\*(R', \*(L'=\*(R', \*(L':\*(R', \*(L',\*(R', \*(L'(\*(R', \*(L')\*(R', \*(L'\e\*(R'.
                    757: .SH "EXAMPLES"
                    758: Below are example \fIsudoers\fR entries.  Admittedly, some of
                    759: these are a bit contrived.  First, we define our \fIaliases\fR:
                    760: .PP
                    761: .Vb 4
                    762: \& # User alias specification
                    763: \& User_Alias     FULLTIMERS = millert, mikef, dowdy
                    764: \& User_Alias     PARTTIMERS = bostley, jwfox, crawl
                    765: \& User_Alias     WEBMASTERS = will, wendy, wim
                    766: .Ve
                    767: .Vb 3
                    768: \& # Runas alias specification
                    769: \& Runas_Alias    OP = root, operator
                    770: \& Runas_Alias    DB = oracle, sybase
                    771: .Ve
                    772: .Vb 9
                    773: \& # Host alias specification
                    774: \& Host_Alias     SPARC = bigtime, eclipse, moet, anchor :\e
                    775: \&                SGI = grolsch, dandelion, black :\e
                    776: \&                ALPHA = widget, thalamus, foobar :\e
                    777: \&                HPPA = boa, nag, python
                    778: \& Host_Alias     CUNETS = 128.138.0.0/255.255.0.0
                    779: \& Host_Alias     CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
                    780: \& Host_Alias     SERVERS = master, mail, www, ns
                    781: \& Host_Alias     CDROM = orion, perseus, hercules
                    782: .Ve
                    783: .Vb 12
                    784: \& # Cmnd alias specification
                    785: \& Cmnd_Alias     DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\e
                    786: \&                        /usr/sbin/restore, /usr/sbin/rrestore
                    787: \& Cmnd_Alias     KILL = /usr/bin/kill
                    788: \& Cmnd_Alias     PRINTING = /usr/sbin/lpc, /usr/bin/lprm
                    789: \& Cmnd_Alias     SHUTDOWN = /usr/sbin/shutdown
                    790: \& Cmnd_Alias     HALT = /usr/sbin/halt, /usr/sbin/fasthalt
                    791: \& Cmnd_Alias     REBOOT = /usr/sbin/reboot, /usr/sbin/fastboot
                    792: \& Cmnd_Alias     SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh, \e
                    793: \&                         /usr/local/bin/tcsh, /usr/bin/rsh, \e
                    794: \&                         /usr/local/bin/zsh
                    795: \& Cmnd_Alias     SU = /usr/bin/su
                    796: .Ve
                    797: Here we override some of the compiled in default values.  We want
1.5     ! millert   798: \fBsudo\fR to log via \fIsyslog\fR\|(3) using the \fIauth\fR facility in all cases.
1.1       millert   799: We don't want to subject the full time staff to the \fBsudo\fR lecture,
                    800: and user \fBmillert\fR need not give a password.  In addition, on the
                    801: machines in the \fISERVERS\fR \f(CWHost_Alias\fR, we keep an additional
                    802: local log file and make sure we log the year in each log line since
                    803: the log entries will be kept around for several years.
                    804: .PP
                    805: .Vb 5
                    806: \& # Override builtin defaults
                    807: \& Defaults               syslog=auth
                    808: \& Defaults:FULLTIMERS    !lecture
                    809: \& Defaults:millert       !authenticate
                    810: \& Defaults@SERVERS       log_year, logfile=/var/log/sudo.log
                    811: .Ve
                    812: The \fIUser specification\fR is the part that actually determines who may
                    813: run what.
                    814: .PP
                    815: .Vb 2
                    816: \& root           ALL = (ALL) ALL
                    817: \& %wheel         ALL = (ALL) ALL
                    818: .Ve
                    819: We let \fBroot\fR and any user in group \fBwheel\fR run any command on any
                    820: host as any user.
                    821: .PP
                    822: .Vb 1
                    823: \& FULLTIMERS     ALL = NOPASSWD: ALL
                    824: .Ve
                    825: Full time sysadmins (\fBmillert\fR, \fBmikef\fR, and \fBdowdy\fR) may run any
                    826: command on any host without authenticating themselves.
                    827: .PP
                    828: .Vb 1
                    829: \& PARTTIMERS     ALL = ALL
                    830: .Ve
                    831: Part time sysadmins (\fBbostley\fR, \fBjwfox\fR, and \fBcrawl\fR) may run any
                    832: command on any host but they must authenticate themselves first
                    833: (since the entry lacks the \f(CWNOPASSWD\fR tag).
                    834: .PP
                    835: .Vb 1
                    836: \& jack           CSNETS = ALL
                    837: .Ve
                    838: The user \fBjack\fR may run any command on the machines in the \fICSNETS\fR alias
                    839: (the networks \f(CW128.138.243.0\fR, \f(CW128.138.204.0\fR, and \f(CW128.138.242.0\fR).
                    840: Of those networks, only <128.138.204.0> has an explicit netmask (in
                    841: CIDR notation) indicating it is a class C network.  For the other
                    842: networks in \fICSNETS\fR, the local machine's netmask will be used
                    843: during matching.
                    844: .PP
                    845: .Vb 1
                    846: \& lisa           CUNETS = ALL
                    847: .Ve
                    848: The user \fBlisa\fR may run any command on any host in the \fICUNETS\fR alias
                    849: (the class B network \f(CW128.138.0.0\fR).
                    850: .PP
                    851: .Vb 2
                    852: \& operator       ALL = DUMPS, KILL, PRINTING, SHUTDOWN, HALT, REBOOT,\e
                    853: \&                /usr/oper/bin/
                    854: .Ve
                    855: The \fBoperator\fR user may run commands limited to simple maintenance.
                    856: Here, those are commands related to backups, killing processes, the
                    857: printing system, shutting down the system, and any commands in the
                    858: directory \fI/usr/oper/bin/\fR.
                    859: .PP
                    860: .Vb 1
                    861: \& joe            ALL = /usr/bin/su operator
                    862: .Ve
                    863: The user \fBjoe\fR may only \fIsu\fR\|(1) to operator.
                    864: .PP
                    865: .Vb 1
                    866: \& pete           HPPA = /usr/bin/passwd [A-z]*, !/usr/bin/passwd root
                    867: .Ve
                    868: The user \fBpete\fR is allowed to change anyone's password except for
                    869: root on the \fIHPPA\fR machines.  Note that this assumes \fIpasswd\fR\|(1)
                    870: does not take multiple usernames on the command line.
                    871: .PP
                    872: .Vb 1
                    873: \& bob            SPARC = (OP) ALL : SGI = (OP) ALL
                    874: .Ve
                    875: The user \fBbob\fR may run anything on the \fISPARC\fR and \fISGI\fR machines
                    876: as any user listed in the \fIOP\fR \f(CWRunas_Alias\fR (\fBroot\fR and \fBoperator\fR).
                    877: .PP
                    878: .Vb 1
                    879: \& jim            +biglab = ALL
                    880: .Ve
                    881: The user \fBjim\fR may run any command on machines in the \fIbiglab\fR netgroup.
                    882: \fBSudo\fR knows that \*(L"biglab\*(R" is a netgroup due to the \*(L'+\*(R' prefix.
                    883: .PP
                    884: .Vb 1
                    885: \& +secretaries   ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser
                    886: .Ve
                    887: Users in the \fBsecretaries\fR netgroup need to help manage the printers
                    888: as well as add and remove users, so they are allowed to run those
                    889: commands on all machines.
                    890: .PP
                    891: .Vb 1
                    892: \& fred           ALL = (DB) NOPASSWD: ALL
                    893: .Ve
                    894: The user \fBfred\fR can run commands as any user in the \fIDB\fR \f(CWRunas_Alias\fR
                    895: (\fBoracle\fR or \fBsybase\fR) without giving a password.
                    896: .PP
                    897: .Vb 1
                    898: \& john           ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*
                    899: .Ve
                    900: On the \fIALPHA\fR machines, user \fBjohn\fR may su to anyone except root
                    901: but he is not allowed to give \fIsu\fR\|(1) any flags.
                    902: .PP
                    903: .Vb 1
                    904: \& jen            ALL, !SERVERS = ALL
                    905: .Ve
                    906: The user \fBjen\fR may run any command on any machine except for those
                    907: in the \fISERVERS\fR \f(CWHost_Alias\fR (master, mail, www and ns).
                    908: .PP
                    909: .Vb 1
                    910: \& jill           SERVERS = /usr/bin/, !SU, !SHELLS
                    911: .Ve
                    912: For any machine in the \fISERVERS\fR \f(CWHost_Alias\fR, \fBjill\fR may run
                    913: any commands in the directory /usr/bin/ except for those commands
                    914: belonging to the \fISU\fR and \fISHELLS\fR \f(CWCmnd_Aliases\fR.
                    915: .PP
                    916: .Vb 1
                    917: \& steve          CSNETS = (operator) /usr/local/op_commands/
                    918: .Ve
                    919: The user \fBsteve\fR may run any command in the directory /usr/local/op_commands/
                    920: but only as user operator.
                    921: .PP
                    922: .Vb 1
                    923: \& matt           valkyrie = KILL
                    924: .Ve
                    925: On his personal workstation, valkyrie, \fBmatt\fR needs to be able to
                    926: kill hung processes.
                    927: .PP
                    928: .Vb 1
                    929: \& WEBMASTERS     www = (www) ALL, (root) /usr/bin/su www
                    930: .Ve
                    931: On the host www, any user in the \fIWEBMASTERS\fR \f(CWUser_Alias\fR (will,
                    932: wendy, and wim), may run any command as user www (which owns the
                    933: web pages) or simply \fIsu\fR\|(1) to www.
                    934: .PP
                    935: .Vb 2
                    936: \& ALL            CDROM = NOPASSWD: /sbin/umount /CDROM,\e
                    937: \&                /sbin/mount -o nosuid\e,nodev /dev/cd0a /CDROM
                    938: .Ve
                    939: Any user may mount or unmount a CD\-ROM on the machines in the CDROM
                    940: \f(CWHost_Alias\fR (orion, perseus, hercules) without entering a password.
                    941: This is a bit tedious for users to type, so it is a prime candiate
                    942: for encapsulating in a shell script.
                    943: .SH "SECURITY NOTES"
                    944: It is generally not effective to \*(L"subtract\*(R" commands from \f(CWALL\fR
                    945: using the \*(L'!\*(R' operator.  A user can trivially circumvent this
                    946: by copying the desired command to a different name and then
                    947: executing that.  For example:
                    948: .PP
                    949: .Vb 1
                    950: \&    bill        ALL = ALL, !SU, !SHELLS
                    951: .Ve
                    952: Doesn't really prevent \fBbill\fR from running the commands listed in
                    953: \fISU\fR or \fISHELLS\fR since he can simply copy those commands to a
                    954: different name, or use a shell escape from an editor or other
                    955: program.  Therefore, these kind of restrictions should be considered
                    956: advisory at best (and reinforced by policy).
                    957: .SH "CAVEATS"
                    958: The \fIsudoers\fR file should \fBalways\fR be edited by the \fBvisudo\fR
                    959: command which locks the file and does grammatical checking. It is
                    960: imperative that \fIsudoers\fR be free of syntax errors since \fBsudo\fR
                    961: will not run with a syntactically incorrect \fIsudoers\fR file.
1.3       millert   962: .PP
                    963: When using netgroups of machines (as opposed to users), if you
1.5     ! millert   964: store fully qualified hostnames in the netgroup (as is usually the
        !           965: case), you either need to have the machine's hostname be fully qualified
1.3       millert   966: as returned by the \f(CWhostname\fR command or use the \fIfqdn\fR option in
                    967: \fIsudoers\fR.
1.1       millert   968: .SH "FILES"
                    969: .PP
                    970: .Vb 3
                    971: \& /etc/sudoers           List of who can run what
                    972: \& /etc/group             Local groups file
                    973: \& /etc/netgroup          List of network groups
                    974: .Ve
                    975: .SH "SEE ALSO"
                    976: \fIsudo\fR\|(8), \fIvisudo\fR\|(8), \fIsu\fR\|(1), \fIfnmatch\fR\|(3).
                    977:
                    978: .rn }` ''
                    979: .IX Title "sudoers 5"
                    980: .IX Name "sudoers - list of which users may execute what"
                    981:
                    982: .IX Header "NAME"
                    983:
                    984: .IX Header "DESCRIPTION"
                    985:
                    986: .IX Subsection "Quick guide to \s-1EBNF\s0"
                    987:
                    988: .IX Item "\f(CW?\fR"
                    989:
                    990: .IX Item "\f(CW*\fR"
                    991:
                    992: .IX Item "\f(CW+\fR"
                    993:
                    994: .IX Subsection "Aliases"
                    995:
                    996: .IX Subsection "Defaults"
                    997:
                    998: .IX Item "long_otp_prompt"
                    999:
                   1000: .IX Item "ignore_dot"
                   1001:
                   1002: .IX Item "mail_always"
                   1003:
                   1004: .IX Item "mail_no_user"
                   1005:
                   1006: .IX Item "mail_no_host"
                   1007:
                   1008: .IX Item "mail_no_perms"
                   1009:
                   1010: .IX Item "tty_tickets"
                   1011:
                   1012: .IX Item "lecture"
                   1013:
                   1014: .IX Item "authenticate"
                   1015:
                   1016: .IX Item "root_sudo"
                   1017:
                   1018: .IX Item "log_host"
                   1019:
                   1020: .IX Item "log_year"
                   1021:
                   1022: .IX Item "shell_noargs"
                   1023:
                   1024: .IX Item "set_home"
                   1025:
                   1026: .IX Item "path_info"
                   1027:
                   1028: .IX Item "fqdn"
                   1029:
                   1030: .IX Item "insults"
                   1031:
                   1032: .IX Item "requiretty"
                   1033:
1.5     ! millert  1034: .IX Item "env_editor"
        !          1035:
        !          1036: .IX Item "rootpw"
        !          1037:
        !          1038: .IX Item "runaspw"
        !          1039:
        !          1040: .IX Item "targetpw"
        !          1041:
        !          1042: .IX Item "set_logname"
        !          1043:
1.1       millert  1044: .IX Item "passwd_tries"
                   1045:
                   1046: .IX Item "loglinelen"
                   1047:
                   1048: .IX Item "timestamp_timeout"
                   1049:
                   1050: .IX Item "passwd_timeout"
                   1051:
                   1052: .IX Item "umask"
                   1053:
                   1054: .IX Item "mailsub"
                   1055:
                   1056: .IX Item "badpass_message"
                   1057:
                   1058: .IX Item "timestampdir"
                   1059:
                   1060: .IX Item "passprompt"
                   1061:
                   1062: .IX Item "runas_default"
                   1063:
                   1064: .IX Item "syslog_goodpri"
                   1065:
                   1066: .IX Item "syslog_badpri"
1.5     ! millert  1067:
        !          1068: .IX Item "editor"
        !          1069:
        !          1070: .IX Item "logfile"
1.1       millert  1071:
                   1072: .IX Item "syslog"
                   1073:
                   1074: .IX Item "mailerpath"
                   1075:
                   1076: .IX Item "mailerflags"
                   1077:
                   1078: .IX Item "mailto"
                   1079:
                   1080: .IX Item "exempt_group"
                   1081:
                   1082: .IX Item "secure_path"
                   1083:
1.3       millert  1084: .IX Item "verifypw"
                   1085:
                   1086: .IX Item "listpw"
                   1087:
1.1       millert  1088: .IX Subsection "User Specification"
                   1089:
                   1090: .IX Subsection "Runas_Spec"
                   1091:
                   1092: .IX Subsection "\s-1NOPASSWD\s0 and \s-1PASSWD\s0"
                   1093:
                   1094: .IX Subsection "Wildcards (aka meta characters):"
                   1095:
                   1096: .IX Item "\f(CW*\fR"
                   1097:
                   1098: .IX Item "\f(CW?\fR"
                   1099:
                   1100: .IX Item "\f(CW[...]\fR"
                   1101:
                   1102: .IX Item "\f(CW[!...]\fR"
                   1103:
                   1104: .IX Item "\f(CW\ex\fR"
                   1105:
                   1106: .IX Subsection "Exceptions to wildcard rules:"
                   1107:
1.3       millert  1108: .IX Item \f(CW""\fR
1.1       millert  1109:
                   1110: .IX Subsection "Other special characters and reserved words:"
                   1111:
                   1112: .IX Header "EXAMPLES"
                   1113:
                   1114: .IX Header "SECURITY NOTES"
                   1115:
                   1116: .IX Header "CAVEATS"
                   1117:
                   1118: .IX Header "FILES"
                   1119:
                   1120: .IX Header "SEE ALSO"
                   1121: