Imported Upstream version 1.6.9p10
[debian/sudo] / sudoers.cat
1
2
3
4 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
5
6
7 N\bNA\bAM\bME\bE
8        sudoers - list of which users may execute what
9
10 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
11        The _\bs_\bu_\bd_\bo_\be_\br_\bs file is composed of two types of entries:
12        aliases (basically variables) and user specifications
13        (which specify who may run what).
14
15        When multiple entries match for a user, they are applied
16        in order.  Where there are multiple matches, the last
17        match is used (which is not necessarily the most specific
18        match).
19
20        The _\bs_\bu_\bd_\bo_\be_\br_\bs grammar will be described below in Extended
21        Backus-Naur Form (EBNF).  Don't despair if you don't know
22        what EBNF is; it is fairly simple, and the definitions
23        below are annotated.
24
25        Q\bQu\bui\bic\bck\bk g\bgu\bui\bid\bde\be t\bto\bo E\bEB\bBN\bNF\bF
26
27        EBNF is a concise and exact way of describing the grammar
28        of a language.  Each EBNF definition is made up of _\bp_\br_\bo_\bd_\bu_\bc_\b­
29        _\bt_\bi_\bo_\bn _\br_\bu_\bl_\be_\bs.  E.g.,
30
31         symbol ::= definition | alternate1 | alternate2 ...
32
33        Each _\bp_\br_\bo_\bd_\bu_\bc_\bt_\bi_\bo_\bn _\br_\bu_\bl_\be references others and thus makes up a
34        grammar for the language.  EBNF also contains the follow­
35        ing operators, which many readers will recognize from reg­
36        ular expressions.  Do not, however, confuse them with
37        "wildcard" characters, which have different meanings.
38
39        ?   Means that the preceding symbol (or group of symbols)
40            is optional.  That is, it may appear once or not at
41            all.
42
43        *   Means that the preceding symbol (or group of symbols)
44            may appear zero or more times.
45
46        +   Means that the preceding symbol (or group of symbols)
47            may appear one or more times.
48
49        Parentheses may be used to group symbols together.  For
50        clarity, we will use single quotes ('') to designate what
51        is a verbatim character string (as opposed to a symbol
52        name).
53
54        A\bAl\bli\bia\bas\bse\bes\bs
55
56        There are four kinds of aliases: User_Alias, Runas_Alias,
57        Host_Alias and Cmnd_Alias.
58
59
60
61
62
63
64 1.6.9p10                December 17, 2007                       1
65
66
67
68
69
70 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
71
72
73         Alias ::= 'User_Alias'  User_Alias (':' User_Alias)* |
74                   'Runas_Alias' Runas_Alias (':' Runas_Alias)* |
75                   'Host_Alias'  Host_Alias (':' Host_Alias)* |
76                   'Cmnd_Alias'  Cmnd_Alias (':' Cmnd_Alias)*
77
78         User_Alias ::= NAME '=' User_List
79
80         Runas_Alias ::= NAME '=' Runas_List
81
82         Host_Alias ::= NAME '=' Host_List
83
84         Cmnd_Alias ::= NAME '=' Cmnd_List
85
86         NAME ::= [A-Z]([A-Z][0-9]_)*
87
88        Each _\ba_\bl_\bi_\ba_\bs definition is of the form
89
90         Alias_Type NAME = item1, item2, ...
91
92        where _\bA_\bl_\bi_\ba_\bs_\b__\bT_\by_\bp_\be is one of User_Alias, Runas_Alias,
93        Host_Alias, or Cmnd_Alias.  A NAME is a string of upper­
94        case letters, numbers, and underscore characters ('_').  A
95        NAME m\bmu\bus\bst\bt start with an uppercase letter.  It is possible
96        to put several alias definitions of the same type on a
97        single line, joined by a colon (':').  E.g.,
98
99         Alias_Type NAME = item1, item2, item3 : NAME = item4, item5
100
101        The definitions of what constitutes a valid _\ba_\bl_\bi_\ba_\bs member
102        follow.
103
104         User_List ::= User |
105                       User ',' User_List
106
107         User ::= '!'* username |
108                  '!'* '%'group |
109                  '!'* '+'netgroup |
110                  '!'* User_Alias
111
112        A User_List is made up of one or more usernames, system
113        groups (prefixed with '%'), netgroups (prefixed with '+')
114        and other aliases.  Each list item may be prefixed with
115        one or more '!' operators.  An odd number of '!' operators
116        negate the value of the item; an even number just cancel
117        each other out.
118
119         Runas_List ::= Runas_User |
120                        Runas_User ',' Runas_List
121
122         Runas_User ::= '!'* username |
123                        '!'* '#'uid |
124                        '!'* '%'group |
125                        '!'* +netgroup |
126                        '!'* Runas_Alias
127
128
129
130 1.6.9p10                December 17, 2007                       2
131
132
133
134
135
136 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
137
138
139        A Runas_List is similar to a User_List except that it can
140        also contain uids (prefixed with '#') and instead of
141        User_Aliases it can contain Runas_Aliases.  Note that
142        usernames and groups are matched as strings.  In other
143        words, two users (groups) with the same uid (gid) are con­
144        sidered to be distinct.  If you wish to match all user­
145        names with the same uid (e.g. root and toor), you can use
146        a uid instead (#0 in the example given).
147
148         Host_List ::= Host |
149                       Host ',' Host_List
150
151         Host ::= '!'* hostname |
152                  '!'* ip_addr |
153                  '!'* network(/netmask)? |
154                  '!'* '+'netgroup |
155                  '!'* Host_Alias
156
157        A Host_List is made up of one or more hostnames, IP
158        addresses, network numbers, netgroups (prefixed with '+')
159        and other aliases.  Again, the value of an item may be
160        negated with the '!' operator.  If you do not specify a
161        netmask along with the network number, s\bsu\bud\bdo\bo will query
162        each of the local host's network interfaces and, if the
163        network number corresponds to one of the hosts's network
164        interfaces, the corresponding netmask will be used.  The
165        netmask may be specified either in standard IP address
166        notation (e.g. 255.255.255.0 or ffff:ffff:ffff:ffff::), or
167        CIDR notation (number of bits, e.g. 24 or 64).  A hostname
168        may include shell-style wildcards (see the Wildcards sec­
169        tion below), but unless the hostname command on your
170        machine returns the fully qualified hostname, you'll need
171        to use the _\bf_\bq_\bd_\bn option for wildcards to be useful.
172
173         Cmnd_List ::= Cmnd |
174                       Cmnd ',' Cmnd_List
175
176         commandname ::= filename |
177                         filename args |
178                         filename '""'
179
180         Cmnd ::= '!'* commandname |
181                  '!'* directory |
182                  '!'* "sudoedit" |
183                  '!'* Cmnd_Alias
184
185        A Cmnd_List is a list of one or more commandnames, direc­
186        tories, and other aliases.  A commandname is a fully qual­
187        ified filename which may include shell-style wildcards
188        (see the Wildcards section below).  A simple filename
189        allows the user to run the command with any arguments
190        he/she wishes.  However, you may also specify command line
191        arguments (including wildcards).  Alternately, you can
192        specify "" to indicate that the command may only be run
193
194
195
196 1.6.9p10                December 17, 2007                       3
197
198
199
200
201
202 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
203
204
205        w\bwi\bit\bth\bho\bou\but\bt command line arguments.  A directory is a fully
206        qualified pathname ending in a '/'.  When you specify a
207        directory in a Cmnd_List, the user will be able to run any
208        file within that directory (but not in any subdirectories
209        therein).
210
211        If a Cmnd has associated command line arguments, then the
212        arguments in the Cmnd must match exactly those given by
213        the user on the command line (or match the wildcards if
214        there are any).  Note that the following characters must
215        be escaped with a '\' if they are used in command argu­
216        ments: ',', ':', '=', '\'.  The special command "sudoedit"
217        is used to permit a user to run s\bsu\bud\bdo\bo with the -\b-e\be flag (or
218        as s\bsu\bud\bdo\boe\bed\bdi\bit\bt).  It may take command line arguments just as
219        a normal command does.
220
221        D\bDe\bef\bfa\bau\bul\blt\bts\bs
222
223        Certain configuration options may be changed from their
224        default values at runtime via one or more Default_Entry
225        lines.  These may affect all users on any host, all users
226        on a specific host, a specific user, or commands being run
227        as a specific user.
228
229         Default_Type ::= 'Defaults' |
230                          'Defaults' '@' Host_List |
231                          'Defaults' ':' User_List |
232                          'Defaults' '>' Runas_List
233
234         Default_Entry ::= Default_Type Parameter_List
235
236         Parameter_List ::= Parameter |
237                            Parameter ',' Parameter_List
238
239         Parameter ::= Parameter '=' Value |
240                       Parameter '+=' Value |
241                       Parameter '-=' Value |
242                       '!'* Parameter
243
244        Parameters may be f\bfl\bla\bag\bgs\bs, i\bin\bnt\bte\beg\bge\ber\br values, s\bst\btr\bri\bin\bng\bgs\bs, or
245        l\bli\bis\bst\bts\bs.  Flags are implicitly boolean and can be turned off
246        via the '!'  operator.  Some integer, string and list
247        parameters may also be used in a boolean context to dis­
248        able them.  Values may be enclosed in double quotes (")
249        when they contain multiple words.  Special characters may
250        be escaped with a backslash (\).
251
252        Lists have two additional assignment operators, += and -=.
253        These operators are used to add to and delete from a list
254        respectively.  It is not an error to use the -= operator
255        to remove an element that does not exist in a list.
256
257        See "SUDOERS OPTIONS" for a list of supported Defaults
258        parameters.
259
260
261
262 1.6.9p10                December 17, 2007                       4
263
264
265
266
267
268 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
269
270
271        U\bUs\bse\ber\br S\bSp\bpe\bec\bci\bif\bfi\bic\bca\bat\bti\bio\bon\bn
272
273         User_Spec ::= User_List Host_List '=' Cmnd_Spec_List \
274                       (':' Host_List '=' Cmnd_Spec_List)*
275
276         Cmnd_Spec_List ::= Cmnd_Spec |
277                            Cmnd_Spec ',' Cmnd_Spec_List
278
279         Cmnd_Spec ::= Runas_Spec? Tag_Spec* Cmnd
280
281         Runas_Spec ::= '(' Runas_List ')'
282
283         Tag_Spec ::= ('NOPASSWD:' | 'PASSWD:' | 'NOEXEC:' | 'EXEC:' |
284                       'SETENV:' | 'NOSETENV:')
285
286        A u\bus\bse\ber\br s\bsp\bpe\bec\bci\bif\bfi\bic\bca\bat\bti\bio\bon\bn determines which commands a user may
287        run (and as what user) on specified hosts.  By default,
288        commands are run as r\bro\boo\bot\bt, but this can be changed on a
289        per-command basis.
290
291        Let's break that down into its constituent parts:
292
293        R\bRu\bun\bna\bas\bs_\b_S\bSp\bpe\bec\bc
294
295        A Runas_Spec is simply a Runas_List (as defined above)
296        enclosed in a set of parentheses.  If you do not specify a
297        Runas_Spec in the user specification, a default Runas_Spec
298        of r\bro\boo\bot\bt will be used.  A Runas_Spec sets the default for
299        commands that follow it.  What this means is that for the
300        entry:
301
302         dgb    boulder = (operator) /bin/ls, /bin/kill, /usr/bin/lprm
303
304        The user d\bdg\bgb\bb may run _\b/_\bb_\bi_\bn_\b/_\bl_\bs, _\b/_\bb_\bi_\bn_\b/_\bk_\bi_\bl_\bl, and _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bl_\bp_\br_\bm
305        -- but only as o\bop\bpe\ber\bra\bat\bto\bor\br.  E.g.,
306
307         $ sudo -u operator /bin/ls.
308
309        It is also possible to override a Runas_Spec later on in
310        an entry.  If we modify the entry like so:
311
312         dgb    boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm
313
314        Then user d\bdg\bgb\bb is now allowed to run _\b/_\bb_\bi_\bn_\b/_\bl_\bs as o\bop\bpe\ber\bra\bat\bto\bor\br,
315        but  _\b/_\bb_\bi_\bn_\b/_\bk_\bi_\bl_\bl and _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bl_\bp_\br_\bm as r\bro\boo\bot\bt.
316
317        T\bTa\bag\bg_\b_S\bSp\bpe\bec\bc
318
319        A command may have zero or more tags associated with it.
320        There are six possible tag values, NOPASSWD, PASSWD,
321        NOEXEC, EXEC, SETENV and NOSETENV.  Once a tag is set on a
322        Cmnd, subsequent Cmnds in the Cmnd_Spec_List, inherit the
323        tag unless it is overridden by the opposite tag (i.e.:
324        PASSWD overrides NOPASSWD and NOEXEC overrides EXEC).
325
326
327
328 1.6.9p10                December 17, 2007                       5
329
330
331
332
333
334 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
335
336
337        _\bN_\bO_\bP_\bA_\bS_\bS_\bW_\bD _\ba_\bn_\bd _\bP_\bA_\bS_\bS_\bW_\bD
338
339        By default, s\bsu\bud\bdo\bo requires that a user authenticate him or
340        herself before running a command.  This behavior can be
341        modified via the NOPASSWD tag.  Like a Runas_Spec, the
342        NOPASSWD tag sets a default for the commands that follow
343        it in the Cmnd_Spec_List.  Conversely, the PASSWD tag can
344        be used to reverse things.  For example:
345
346         ray    rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
347
348        would allow the user r\bra\bay\by to run _\b/_\bb_\bi_\bn_\b/_\bk_\bi_\bl_\bl, _\b/_\bb_\bi_\bn_\b/_\bl_\bs, and
349        _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bl_\bp_\br_\bm as root on the machine rushmore as r\bro\boo\bot\bt
350        without authenticating himself.  If we only want r\bra\bay\by to be
351        able to run _\b/_\bb_\bi_\bn_\b/_\bk_\bi_\bl_\bl without a password the entry would
352        be:
353
354         ray    rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
355
356        Note, however, that the PASSWD tag has no effect on users
357        who are in the group specified by the _\be_\bx_\be_\bm_\bp_\bt_\b__\bg_\br_\bo_\bu_\bp option.
358
359        By default, if the NOPASSWD tag is applied to any of the
360        entries for a user on the current host, he or she will be
361        able to run sudo -l without a password.  Additionally, a
362        user may only run sudo -v without a password if the
363        NOPASSWD tag is present for all a user's entries that per­
364        tain to the current host.  This behavior may be overridden
365        via the verifypw and listpw options.
366
367        _\bN_\bO_\bE_\bX_\bE_\bC _\ba_\bn_\bd _\bE_\bX_\bE_\bC
368
369        If s\bsu\bud\bdo\bo has been compiled with _\bn_\bo_\be_\bx_\be_\bc support and the
370        underlying operating system supports it, the NOEXEC tag
371        can be used to prevent a dynamically-linked executable
372        from running further commands itself.
373
374        In the following example, user a\baa\bar\bro\bon\bn may run _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bm_\bo_\br_\be
375        and _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bv_\bi but shell escapes will be disabled.
376
377         aaron  shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
378
379        See the "PREVENTING SHELL ESCAPES" section below for more
380        details on how NOEXEC works and whether or not it will
381        work on your system.
382
383        _\bS_\bE_\bT_\bE_\bN_\bV _\ba_\bn_\bd _\bN_\bO_\bS_\bE_\bT_\bE_\bN_\bV
384
385        These tags override the value of the _\bs_\be_\bt_\be_\bn_\bv option on a
386        per-command basis.  Note that if SETENV has been set for a
387        command, any environment variables set on the command line
388        way are not subject to the restrictions imposed by
389        _\be_\bn_\bv_\b__\bc_\bh_\be_\bc_\bk, _\be_\bn_\bv_\b__\bd_\be_\bl_\be_\bt_\be, or _\be_\bn_\bv_\b__\bk_\be_\be_\bp.  As such, only trusted
390        users should be allowed to set variables in this manner.
391
392
393
394 1.6.9p10                December 17, 2007                       6
395
396
397
398
399
400 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
401
402
403        If the command matched is A\bAL\bLL\bL, the SETENV tag is implied
404        for that command; this default may be overridden by use of
405        the UNSETENV tag.
406
407        W\bWi\bil\bld\bdc\bca\bar\brd\bds\bs
408
409        s\bsu\bud\bdo\bo allows shell-style _\bw_\bi_\bl_\bd_\bc_\ba_\br_\bd_\bs (aka meta or glob char­
410        acters) to be used in pathnames as well as command line
411        arguments in the _\bs_\bu_\bd_\bo_\be_\br_\bs file.  Wildcard matching is done
412        via the P\bPO\bOS\bSI\bIX\bX _\bf_\bn_\bm_\ba_\bt_\bc_\bh(3) routine.  Note that these are _\bn_\bo_\bt
413        regular expressions.
414
415        *       Matches any set of zero or more characters.
416
417        ?       Matches any single character.
418
419        [...]   Matches any character in the specified range.
420
421        [!...]  Matches any character n\bno\bot\bt in the specified range.
422
423        \x      For any character "x", evaluates to "x".  This is
424                used to escape special characters such as: "*",
425                "?", "[", and "}".
426
427        Note that a forward slash ('/') will n\bno\bot\bt be matched by
428        wildcards used in the pathname.  When matching the command
429        line arguments, however, a slash d\bdo\boe\bes\bs get matched by wild­
430        cards.  This is to make a path like:
431
432            /usr/bin/*
433
434        match _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bw_\bh_\bo but not _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bX_\b1_\b1_\b/_\bx_\bt_\be_\br_\bm.
435
436        E\bEx\bxc\bce\bep\bpt\bti\bio\bon\bns\bs t\bto\bo w\bwi\bil\bld\bdc\bca\bar\brd\bd r\bru\bul\ble\bes\bs
437
438        The following exceptions apply to the above rules:
439
440        ""      If the empty string "" is the only command line
441                argument in the _\bs_\bu_\bd_\bo_\be_\br_\bs entry it means that com­
442                mand is not allowed to be run with a\ban\bny\by arguments.
443
444        O\bOt\bth\bhe\ber\br s\bsp\bpe\bec\bci\bia\bal\bl c\bch\bha\bar\bra\bac\bct\bte\ber\brs\bs a\ban\bnd\bd r\bre\bes\bse\ber\brv\bve\bed\bd w\bwo\bor\brd\bds\bs
445
446        The pound sign ('#') is used to indicate a comment (unless
447        it is part of a #include directive or unless it occurs in
448        the context of a user name and is followed by one or more
449        digits, in which case it is treated as a uid).  Both the
450        comment character and any text after it, up to the end of
451        the line, are ignored.
452
453        The reserved word A\bAL\bLL\bL is a built-in _\ba_\bl_\bi_\ba_\bs that always
454        causes a match to succeed.  It can be used wherever one
455        might otherwise use a Cmnd_Alias, User_Alias, Runas_Alias,
456        or Host_Alias.  You should not try to define your own
457
458
459
460 1.6.9p10                December 17, 2007                       7
461
462
463
464
465
466 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
467
468
469        _\ba_\bl_\bi_\ba_\bs called A\bAL\bLL\bL as the built-in alias will be used in
470        preference to your own.  Please note that using A\bAL\bLL\bL can be
471        dangerous since in a command context, it allows the user
472        to run a\ban\bny\by command on the system.
473
474        An exclamation point ('!') can be used as a logical _\bn_\bo_\bt
475        operator both in an _\ba_\bl_\bi_\ba_\bs and in front of a Cmnd.  This
476        allows one to exclude certain values.  Note, however, that
477        using a ! in conjunction with the built-in ALL alias to
478        allow a user to run "all but a few" commands rarely works
479        as intended (see SECURITY NOTES below).
480
481        Long lines can be continued with a backslash ('\') as the
482        last character on the line.
483
484        Whitespace between elements in a list as well as special
485        syntactic characters in a _\bU_\bs_\be_\br _\bS_\bp_\be_\bc_\bi_\bf_\bi_\bc_\ba_\bt_\bi_\bo_\bn ('=', ':',
486        '(', ')') is optional.
487
488        The following characters must be escaped with a backslash
489        ('\') when used as part of a word (e.g. a username or
490        hostname): '@', '!', '=', ':', ',', '(', ')', '\'.
491
492 S\bSU\bUD\bDO\bOE\bER\bRS\bS O\bOP\bPT\bTI\bIO\bON\bNS\bS
493        s\bsu\bud\bdo\bo's behavior can be modified by Default_Entry lines, as
494        explained earlier.  A list of all supported Defaults
495        parameters, grouped by type, are listed below.
496
497        F\bFl\bla\bag\bgs\bs:
498
499        always_set_home If set, s\bsu\bud\bdo\bo will set the HOME environment
500                        variable to the home directory of the tar­
501                        get user (which is root unless the -\b-u\bu
502                        option is used).  This effectively means
503                        that the -\b-H\bH flag is always implied.  This
504                        flag is _\bo_\bf_\bf by default.
505
506        authenticate    If set, users must authenticate themselves
507                        via a password (or other means of authen­
508                        tication) before they may run commands.
509                        This default may be overridden via the
510                        PASSWD and NOPASSWD tags.  This flag is _\bo_\bn
511                        by default.
512
513        env_editor      If set, v\bvi\bis\bsu\bud\bdo\bo will use the value of the
514                        EDITOR or VISUAL environment variables
515                        before falling back on the default editor
516                        list.  Note that this may create a secu­
517                        rity hole as it allows the user to run any
518                        arbitrary command as root without logging.
519                        A safer alternative is to place a colon-
520                        separated list of editors in the editor
521                        variable.  v\bvi\bis\bsu\bud\bdo\bo will then only use the
522                        EDITOR or VISUAL if they match a value
523
524
525
526 1.6.9p10                December 17, 2007                       8
527
528
529
530
531
532 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
533
534
535                        specified in editor.  This flag is _\bo_\bf_\bf by
536                        default.
537
538        env_reset       If set, s\bsu\bud\bdo\bo will reset the environment to
539                        only contain the LOGNAME, SHELL, USER,
540                        USERNAME and the SUDO_* variables.  Any
541                        variables in the caller's environment that
542                        match the env_keep and env_check lists are
543                        then added.  The default contents of the
544                        env_keep and env_check lists are displayed
545                        when s\bsu\bud\bdo\bo is run by root with the _\b-_\bV
546                        option.  If s\bsu\bud\bdo\bo was compiled with the
547                        SECURE_PATH option, its value will be used
548                        for the PATH environment variable.  This
549                        flag is _\bo_\bn by default.
550
551        fqdn            Set this flag if you want to put fully
552                        qualified hostnames in the _\bs_\bu_\bd_\bo_\be_\br_\bs file.
553                        I.e., instead of myhost you would use
554                        myhost.mydomain.edu.  You may still use
555                        the short form if you wish (and even mix
556                        the two).  Beware that turning on _\bf_\bq_\bd_\bn
557                        requires s\bsu\bud\bdo\bo to make DNS lookups which
558                        may make s\bsu\bud\bdo\bo unusable if DNS stops work­
559                        ing (for example if the machine is not
560                        plugged into the network).  Also note that
561                        you must use the host's official name as
562                        DNS knows it.  That is, you may not use a
563                        host alias (CNAME entry) due to perfor­
564                        mance issues and the fact that there is no
565                        way to get all aliases from DNS.  If your
566                        machine's hostname (as returned by the
567                        hostname command) is already fully quali­
568                        fied you shouldn't need to set _\bf_\bq_\bd_\bn.  This
569                        flag is _\bo_\bf_\bf by default.
570
571        ignore_dot      If set, s\bsu\bud\bdo\bo will ignore '.' or '' (cur­
572                        rent dir) in the PATH environment vari­
573                        able; the PATH itself is not modified.
574                        This flag is _\bo_\bf_\bf by default.  Currently,
575                        while it is possible to set _\bi_\bg_\bn_\bo_\br_\be_\b__\bd_\bo_\bt in
576                        _\bs_\bu_\bd_\bo_\be_\br_\bs, its value is not used.  This
577                        option should be considered read-only (it
578                        will be fixed in a future version of
579                        s\bsu\bud\bdo\bo).
580
581        ignore_local_sudoers
582                        If set via LDAP, parsing of
583                        @sysconfdir@/sudoers will be skipped.
584                        This is intended for Enterprises that wish
585                        to prevent the usage of local sudoers
586                        files so that only LDAP is used.  This
587                        thwarts the efforts of rogue operators who
588                        would attempt to add roles to
589
590
591
592 1.6.9p10                December 17, 2007                       9
593
594
595
596
597
598 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
599
600
601                        @sysconfdir@/sudoers.  When this option is
602                        present, @sysconfdir@/sudoers does not
603                        even need to exist.  Since this option
604                        tells s\bsu\bud\bdo\bo how to behave when no specific
605                        LDAP entries have been matched, this
606                        sudoOption is only meaningful for the
607                        cn=defaults section.  This flag is _\bo_\bf_\bf by
608                        default.
609
610        insults         If set, s\bsu\bud\bdo\bo will insult users when they
611                        enter an incorrect password.  This flag is
612                        _\bo_\bf_\bf by default.
613
614        log_host        If set, the hostname will be logged in the
615                        (non-syslog) s\bsu\bud\bdo\bo log file.  This flag is
616                        _\bo_\bf_\bf by default.
617
618        log_year        If set, the four-digit year will be logged
619                        in the (non-syslog) s\bsu\bud\bdo\bo log file.  This
620                        flag is _\bo_\bf_\bf by default.
621
622        long_otp_prompt When validating with a One Time Password
623                        (OPT) scheme such as S\bS/\b/K\bKe\bey\by or O\bOP\bPI\bIE\bE, a two-
624                        line prompt is used to make it easier to
625                        cut and paste the challenge to a local
626                        window.  It's not as pretty as the default
627                        but some people find it more convenient.
628                        This flag is _\bo_\bf_\bf by default.
629
630        mail_always     Send mail to the _\bm_\ba_\bi_\bl_\bt_\bo user every time a
631                        users runs s\bsu\bud\bdo\bo.  This flag is _\bo_\bf_\bf by
632                        default.
633
634        mail_badpass    Send mail to the _\bm_\ba_\bi_\bl_\bt_\bo user if the user
635                        running s\bsu\bud\bdo\bo does not enter the correct
636                        password.  This flag is _\bo_\bf_\bf by default.
637
638        mail_no_host    If set, mail will be sent to the _\bm_\ba_\bi_\bl_\bt_\bo
639                        user if the invoking user exists in the
640                        _\bs_\bu_\bd_\bo_\be_\br_\bs file, but is not allowed to run
641                        commands on the current host.  This flag
642                        is _\bo_\bf_\bf by default.
643
644        mail_no_perms   If set, mail will be sent to the _\bm_\ba_\bi_\bl_\bt_\bo
645                        user if the invoking user is allowed to
646                        use s\bsu\bud\bdo\bo but the command they are trying
647                        is not listed in their _\bs_\bu_\bd_\bo_\be_\br_\bs file entry
648                        or is explicitly denied.  This flag is _\bo_\bf_\bf
649                        by default.
650
651        mail_no_user    If set, mail will be sent to the _\bm_\ba_\bi_\bl_\bt_\bo
652                        user if the invoking user is not in the
653                        _\bs_\bu_\bd_\bo_\be_\br_\bs file.  This flag is _\bo_\bn by default.
654
655
656
657
658 1.6.9p10                December 17, 2007                      10
659
660
661
662
663
664 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
665
666
667        noexec          If set, all commands run via s\bsu\bud\bdo\bo will
668                        behave as if the NOEXEC tag has been set,
669                        unless overridden by a EXEC tag.  See the
670                        description of _\bN_\bO_\bE_\bX_\bE_\bC _\ba_\bn_\bd _\bE_\bX_\bE_\bC below as
671                        well as the "PREVENTING SHELL ESCAPES"
672                        section at the end of this manual.  This
673                        flag is _\bo_\bf_\bf by default.
674
675        path_info       Normally, s\bsu\bud\bdo\bo will tell the user when a
676                        command could not be found in their PATH
677                        environment variable.  Some sites may wish
678                        to disable this as it could be used to
679                        gather information on the location of exe­
680                        cutables that the normal user does not
681                        have access to.  The disadvantage is that
682                        if the executable is simply not in the
683                        user's PATH, s\bsu\bud\bdo\bo will tell the user that
684                        they are not allowed to run it, which can
685                        be confusing.  This flag is _\bo_\bn by default.
686
687        passprompt_override
688                        The password prompt specified by
689                        _\bp_\ba_\bs_\bs_\bp_\br_\bo_\bm_\bp_\bt will normally only be used if
690                        the passwod prompt provided by systems
691                        such as PAM matches the string "Pass­
692                        word:".  If _\bp_\ba_\bs_\bs_\bp_\br_\bo_\bm_\bp_\bt_\b__\bo_\bv_\be_\br_\br_\bi_\bd_\be is set,
693                        _\bp_\ba_\bs_\bs_\bp_\br_\bo_\bm_\bp_\bt will always be used.  This flag
694                        is _\bo_\bf_\bf by default.
695
696        preserve_groups By default s\bsu\bud\bdo\bo will initialize the group
697                        vector to the list of groups the target
698                        user is in.  When _\bp_\br_\be_\bs_\be_\br_\bv_\be_\b__\bg_\br_\bo_\bu_\bp_\bs is set,
699                        the user's existing group vector is left
700                        unaltered.  The real and effective group
701                        IDs, however, are still set to match the
702                        target user.  This flag is _\bo_\bf_\bf by default.
703
704        requiretty      If set, s\bsu\bud\bdo\bo will only run when the user
705                        is logged in to a real tty.  This will
706                        disallow things like "rsh somehost sudo
707                        ls" since _\br_\bs_\bh(1) does not allocate a tty.
708                        Because it is not possible to turn off
709                        echo when there is no tty present, some
710                        sites may wish to set this flag to prevent
711                        a user from entering a visible password.
712                        This flag is _\bo_\bf_\bf by default.
713
714        root_sudo       If set, root is allowed to run s\bsu\bud\bdo\bo too.
715                        Disabling this prevents users from "chain­
716                        ing" s\bsu\bud\bdo\bo commands to get a root shell by
717                        doing something like "sudo sudo /bin/sh".
718                        Note, however, that turning off _\br_\bo_\bo_\bt_\b__\bs_\bu_\bd_\bo
719                        will also prevent root and from running
720                        s\bsu\bud\bdo\boe\bed\bdi\bit\bt.  Disabling _\br_\bo_\bo_\bt_\b__\bs_\bu_\bd_\bo provides no
721
722
723
724 1.6.9p10                December 17, 2007                      11
725
726
727
728
729
730 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
731
732
733                        real additional security; it exists purely
734                        for historical reasons.  This flag is _\bo_\bn
735                        by default.
736
737        rootpw          If set, s\bsu\bud\bdo\bo will prompt for the root
738                        password instead of the password of the
739                        invoking user.  This flag is _\bo_\bf_\bf by
740                        default.
741
742        runaspw         If set, s\bsu\bud\bdo\bo will prompt for the password
743                        of the user defined by the _\br_\bu_\bn_\ba_\bs_\b__\bd_\be_\bf_\ba_\bu_\bl_\bt
744                        option (defaults to root) instead of the
745                        password of the invoking user.  This flag
746                        is _\bo_\bf_\bf by default.
747
748        set_home        If set and s\bsu\bud\bdo\bo is invoked with the -\b-s\bs
749                        flag the HOME environment variable will be
750                        set to the home directory of the target
751                        user (which is root unless the -\b-u\bu option
752                        is used).  This effectively makes the -\b-s\bs
753                        flag imply -\b-H\bH.  This flag is _\bo_\bf_\bf by
754                        default.
755
756        set_logname     Normally, s\bsu\bud\bdo\bo will set the LOGNAME, USER
757                        and USERNAME environment variables to the
758                        name of the target user (usually root
759                        unless the -\b-u\bu flag is given).  However,
760                        since some programs (including the RCS
761                        revision control system) use LOGNAME to
762                        determine the real identity of the user,
763                        it may be desirable to change this behav­
764                        ior.  This can be done by negating the
765                        set_logname option.  Note that if the
766                        _\be_\bn_\bv_\b__\br_\be_\bs_\be_\bt option has not been disabled,
767                        entries in the _\be_\bn_\bv_\b__\bk_\be_\be_\bp list will override
768                        the value of _\bs_\be_\bt_\b__\bl_\bo_\bg_\bn_\ba_\bm_\be.  This flag is
769                        _\bo_\bf_\bf by default.
770
771        setenv          Allow the user to disable the _\be_\bn_\bv_\b__\br_\be_\bs_\be_\bt
772                        option from the command line.  Addition­
773                        ally, environment variables set via the
774                        command line are not subject to the
775                        restrictions imposed by _\be_\bn_\bv_\b__\bc_\bh_\be_\bc_\bk,
776                        _\be_\bn_\bv_\b__\bd_\be_\bl_\be_\bt_\be, or _\be_\bn_\bv_\b__\bk_\be_\be_\bp.  As such, only
777                        trusted users should be allowed to set
778                        variables in this manner.  This flag is
779                        _\bo_\bf_\bf by default.
780
781        shell_noargs    If set and s\bsu\bud\bdo\bo is invoked with no argu­
782                        ments it acts as if the -\b-s\bs flag had been
783                        given.  That is, it runs a shell as root
784                        (the shell is determined by the SHELL
785                        environment variable if it is set, falling
786                        back on the shell listed in the invoking
787
788
789
790 1.6.9p10                December 17, 2007                      12
791
792
793
794
795
796 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
797
798
799                        user's /etc/passwd entry if not).  This
800                        flag is _\bo_\bf_\bf by default.
801
802        stay_setuid     Normally, when s\bsu\bud\bdo\bo executes a command the
803                        real and effective UIDs are set to the
804                        target user (root by default).  This
805                        option changes that behavior such that the
806                        real UID is left as the invoking user's
807                        UID.  In other words, this makes s\bsu\bud\bdo\bo act
808                        as a setuid wrapper.  This can be useful
809                        on systems that disable some potentially
810                        dangerous functionality when a program is
811                        run setuid.  This option is only effective
812                        on systems with either the _\bs_\be_\bt_\br_\be_\bu_\bi_\bd_\b(_\b) or
813                        _\bs_\be_\bt_\br_\be_\bs_\bu_\bi_\bd_\b(_\b) function.  This flag is _\bo_\bf_\bf by
814                        default.
815
816        targetpw        If set, s\bsu\bud\bdo\bo will prompt for the password
817                        of the user specified by the -\b-u\bu flag
818                        (defaults to root) instead of the password
819                        of the invoking user.  Note that this pre­
820                        cludes the use of a uid not listed in the
821                        passwd database as an argument to the -\b-u\bu
822                        flag.  This flag is _\bo_\bf_\bf by default.
823
824        tty_tickets     If set, users must authenticate on a per-
825                        tty basis.  Normally, s\bsu\bud\bdo\bo uses a direc­
826                        tory in the ticket dir with the same name
827                        as the user running it.  With this flag
828                        enabled, s\bsu\bud\bdo\bo will use a file named for
829                        the tty the user is logged in on in that
830                        directory.  This flag is _\bo_\bf_\bf by default.
831
832        use_loginclass  If set, s\bsu\bud\bdo\bo will apply the defaults spec­
833                        ified for the target user's login class if
834                        one exists.  Only available if s\bsu\bud\bdo\bo is
835                        configured with the --with-logincap
836                        option.  This flag is _\bo_\bf_\bf by default.
837
838        I\bIn\bnt\bte\beg\bge\ber\brs\bs:
839
840        passwd_tries    The number of tries a user gets to enter
841                        his/her password before s\bsu\bud\bdo\bo logs the
842                        failure and exits.  The default is 3.
843
844        I\bIn\bnt\bte\beg\bge\ber\brs\bs t\bth\bha\bat\bt c\bca\ban\bn b\bbe\be u\bus\bse\bed\bd i\bin\bn a\ba b\bbo\boo\bol\ble\bea\ban\bn c\bco\bon\bnt\bte\bex\bxt\bt:
845
846        loglinelen      Number of characters per line for the file
847                        log.  This value is used to decide when to
848                        wrap lines for nicer log files.  This has
849                        no effect on the syslog log file, only the
850                        file log.  The default is 80 (use 0 or
851                        negate the option to disable word wrap).
852
853
854
855
856 1.6.9p10                December 17, 2007                      13
857
858
859
860
861
862 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
863
864
865        passwd_timeout  Number of minutes before the s\bsu\bud\bdo\bo password
866                        prompt times out.  The default is 5; set
867                        this to 0 for no password timeout.
868
869        timestamp_timeout
870                        Number of minutes that can elapse before
871                        s\bsu\bud\bdo\bo will ask for a passwd again.  The
872                        default is 5.  Set this to 0 to always
873                        prompt for a password.  If set to a value
874                        less than 0 the user's timestamp will
875                        never expire.  This can be used to allow
876                        users to create or delete their own times­
877                        tamps via sudo -v and sudo -k respec­
878                        tively.
879
880        umask           Umask to use when running the command.
881                        Negate this option or set it to 0777 to
882                        preserve the user's umask.  The default is
883                        0022.
884
885        S\bSt\btr\bri\bin\bng\bgs\bs:
886
887        badpass_message Message that is displayed if a user enters
888                        an incorrect password.  The default is
889                        Sorry, try again. unless insults are
890                        enabled.
891
892        editor          A colon (':') separated list of editors
893                        allowed to be used with v\bvi\bis\bsu\bud\bdo\bo.  v\bvi\bis\bsu\bud\bdo\bo
894                        will choose the editor that matches the
895                        user's EDITOR environment variable if pos­
896                        sible, or the first editor in the list
897                        that exists and is executable.  The
898                        default is the path to vi on your system.
899
900        mailsub         Subject of the mail sent to the _\bm_\ba_\bi_\bl_\bt_\bo
901                        user. The escape %h will expand to the
902                        hostname of the machine.  Default is ***
903                        SECURITY information for %h ***.
904
905        noexec_file     Path to a shared library containing dummy
906                        versions of the _\be_\bx_\be_\bc_\bv_\b(_\b), _\be_\bx_\be_\bc_\bv_\be_\b(_\b) and _\bf_\be_\bx_\b­
907                        _\be_\bc_\bv_\be_\b(_\b) library functions that just return
908                        an error.  This is used to implement the
909                        _\bn_\bo_\be_\bx_\be_\bc functionality on systems that sup­
910                        port LD_PRELOAD or its equivalent.
911                        Defaults to
912                        _\b/_\bu_\bs_\br_\b/_\bl_\bo_\bc_\ba_\bl_\b/_\bl_\bi_\bb_\be_\bx_\be_\bc_\b/_\bs_\bu_\bd_\bo_\b__\bn_\bo_\be_\bx_\be_\bc_\b._\bs_\bo.
913
914        passprompt      The default prompt to use when asking for
915                        a password; can be overridden via the -\b-p\bp
916                        option or the SUDO_PROMPT environment
917                        variable.  The following percent (`%')
918                        escapes are supported:
919
920
921
922 1.6.9p10                December 17, 2007                      14
923
924
925
926
927
928 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
929
930
931                        %H  expanded to the local hostname includ­
932                            ing the domain name (on if the
933                            machine's hostname is fully qualified
934                            or the _\bf_\bq_\bd_\bn option is set)
935
936                        %h  expanded to the local hostname without
937                            the domain name
938
939                        %U  expanded to the login name of the user
940                            the command will be run as (defaults
941                            to root)
942
943                        %u  expanded to the invoking user's login
944                            name
945
946                        %%  two consecutive % characters are col­
947                            lapsed into a single % character
948
949                        The default value is Password:.
950
951        runas_default   The default user to run commands as if the
952                        -\b-u\bu flag is not specified on the command
953                        line.  This defaults to root.  Note that
954                        if _\br_\bu_\bn_\ba_\bs_\b__\bd_\be_\bf_\ba_\bu_\bl_\bt is set it m\bmu\bus\bst\bt occur
955                        before any Runas_Alias specifications.
956
957        syslog_badpri   Syslog priority to use when user authenti­
958                        cates unsuccessfully.  Defaults to alert.
959
960        syslog_goodpri  Syslog priority to use when user authenti­
961                        cates successfully.  Defaults to notice.
962
963        timestampdir    The directory in which s\bsu\bud\bdo\bo stores its
964                        timestamp files.  The default is
965                        _\b/_\bv_\ba_\br_\b/_\br_\bu_\bn_\b/_\bs_\bu_\bd_\bo.
966
967        timestampowner  The owner of the timestamp directory and
968                        the timestamps stored therein.  The
969                        default is root.
970
971        S\bSt\btr\bri\bin\bng\bgs\bs t\bth\bha\bat\bt c\bca\ban\bn b\bbe\be u\bus\bse\bed\bd i\bin\bn a\ba b\bbo\boo\bol\ble\bea\ban\bn c\bco\bon\bnt\bte\bex\bxt\bt:
972
973        exempt_group
974                    Users in this group are exempt from password
975                    and PATH requirements.  This is not set by
976                    default.
977
978        lecture     This option controls when a short lecture will
979                    be printed along with the password prompt.  It
980                    has the following possible values:
981
982                    always  Always lecture the user.
983
984                    never   Never lecture the user.
985
986
987
988 1.6.9p10                December 17, 2007                      15
989
990
991
992
993
994 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
995
996
997                    once    Only lecture the user the first time
998                            they run s\bsu\bud\bdo\bo.
999
1000                    If no value is specified, a value of _\bo_\bn_\bc_\be is
1001                    implied.  Negating the option results in a
1002                    value of _\bn_\be_\bv_\be_\br being used.  The default value
1003                    is _\bo_\bn_\bc_\be.
1004
1005        lecture_file
1006                    Path to a file containing an alternate s\bsu\bud\bdo\bo
1007                    lecture that will be used in place of the
1008                    standard lecture if the named file exists.  By
1009                    default, s\bsu\bud\bdo\bo uses a built-in lecture.
1010
1011        listpw      This option controls when a password will be
1012                    required when a user runs s\bsu\bud\bdo\bo with the -\b-l\bl
1013                    flag.  It has the following possible values:
1014
1015                    all     All the user's _\bs_\bu_\bd_\bo_\be_\br_\bs entries for the
1016                            current host must have the NOPASSWD
1017                            flag set to avoid entering a password.
1018
1019                    always  The user must always enter a password
1020                            to use the -\b-l\bl flag.
1021
1022                    any     At least one of the user's _\bs_\bu_\bd_\bo_\be_\br_\bs
1023                            entries for the current host must have
1024                            the NOPASSWD flag set to avoid enter­
1025                            ing a password.
1026
1027                    never   The user need never enter a password
1028                            to use the -\b-l\bl flag.
1029
1030                    If no value is specified, a value of _\ba_\bn_\by is
1031                    implied.  Negating the option results in a
1032                    value of _\bn_\be_\bv_\be_\br being used.  The default value
1033                    is _\ba_\bn_\by.
1034
1035        logfile     Path to the s\bsu\bud\bdo\bo log file (not the syslog log
1036                    file).  Setting a path turns on logging to a
1037                    file; negating this option turns it off.  By
1038                    default, s\bsu\bud\bdo\bo logs via syslog.
1039
1040        mailerflags Flags to use when invoking mailer. Defaults to
1041                    -\b-t\bt.
1042
1043        mailerpath  Path to mail program used to send warning
1044                    mail.  Defaults to the path to sendmail found
1045                    at configure time.
1046
1047        mailto      Address to send warning and error mail to.
1048                    The address should be enclosed in double
1049                    quotes (") to protect against s\bsu\bud\bdo\bo interpret­
1050                    ing the @ sign.  Defaults to root.
1051
1052
1053
1054 1.6.9p10                December 17, 2007                      16
1055
1056
1057
1058
1059
1060 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
1061
1062
1063        syslog      Syslog facility if syslog is being used for
1064                    logging (negate to disable syslog logging).
1065                    Defaults to local2.
1066
1067        verifypw    This option controls when a password will be
1068                    required when a user runs s\bsu\bud\bdo\bo with the -\b-v\bv
1069                    flag.  It has the following possible values:
1070
1071                    all     All the user's _\bs_\bu_\bd_\bo_\be_\br_\bs entries for the
1072                            current host must have the NOPASSWD
1073                            flag set to avoid entering a password.
1074
1075                    always  The user must always enter a password
1076                            to use the -\b-v\bv flag.
1077
1078                    any     At least one of the user's _\bs_\bu_\bd_\bo_\be_\br_\bs
1079                            entries for the current host must have
1080                            the NOPASSWD flag set to avoid enter­
1081                            ing a password.
1082
1083                    never   The user need never enter a password
1084                            to use the -\b-v\bv flag.
1085
1086                    If no value is specified, a value of _\ba_\bl_\bl is
1087                    implied.  Negating the option results in a
1088                    value of _\bn_\be_\bv_\be_\br being used.  The default value
1089                    is _\ba_\bl_\bl.
1090
1091        L\bLi\bis\bst\bts\bs t\bth\bha\bat\bt c\bca\ban\bn b\bbe\be u\bus\bse\bed\bd i\bin\bn a\ba b\bbo\boo\bol\ble\bea\ban\bn c\bco\bon\bnt\bte\bex\bxt\bt:
1092
1093        env_check       Environment variables to be removed from
1094                        the user's environment if the variable's
1095                        value contains % or / characters.  This
1096                        can be used to guard against printf-style
1097                        format vulnerabilities in poorly-written
1098                        programs.  The argument may be a dou­
1099                        ble-quoted, space-separated list or a sin­
1100                        gle value without double-quotes.  The list
1101                        can be replaced, added to, deleted from,
1102                        or disabled by using the =, +=, -=, and !
1103                        operators respectively.  Regardless of
1104                        whether the env_reset option is enabled or
1105                        disabled, variables specified by env_check
1106                        will be preserved in the environment if
1107                        they pass the aforementioned check.  The
1108                        default list of environment variables to
1109                        check is displayed when s\bsu\bud\bdo\bo is run by
1110                        root with the _\b-_\bV option.
1111
1112        env_delete      Environment variables to be removed from
1113                        the user's environment.  The argument may
1114                        be a double-quoted, space-separated list
1115                        or a single value without double-quotes.
1116                        The list can be replaced, added to,
1117
1118
1119
1120 1.6.9p10                December 17, 2007                      17
1121
1122
1123
1124
1125
1126 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
1127
1128
1129                        deleted from, or disabled by using the =,
1130                        +=, -=, and ! operators respectively.  The
1131                        default list of environment variables to
1132                        remove is displayed when s\bsu\bud\bdo\bo is run by
1133                        root with the _\b-_\bV option.  Note that many
1134                        operating systems will remove potentially
1135                        dangerous variables from the environment
1136                        of any setuid process (such as s\bsu\bud\bdo\bo).
1137
1138        env_keep        Environment variables to be preserved in
1139                        the user's environment when the _\be_\bn_\bv_\b__\br_\be_\bs_\be_\bt
1140                        option is in effect.  This allows fine-
1141                        grained control over the environment
1142                        s\bsu\bud\bdo\bo-spawned processes will receive.  The
1143                        argument may be a double-quoted, space-
1144                        separated list or a single value without
1145                        double-quotes.  The list can be replaced,
1146                        added to, deleted from, or disabled by
1147                        using the =, +=, -=, and ! operators
1148                        respectively.  The default list of vari­
1149                        ables to keep is displayed when s\bsu\bud\bdo\bo is
1150                        run by root with the _\b-_\bV option.
1151
1152        When logging via _\bs_\by_\bs_\bl_\bo_\bg(3), s\bsu\bud\bdo\bo accepts the following
1153        values for the syslog facility (the value of the s\bsy\bys\bsl\blo\bog\bg
1154        Parameter): a\bau\but\bth\bhp\bpr\bri\biv\bv (if your OS supports it), a\bau\but\bth\bh, d\bda\bae\b\b­
1155        m\bmo\bon\bn, u\bus\bse\ber\br, l\blo\boc\bca\bal\bl0\b0, l\blo\boc\bca\bal\bl1\b1, l\blo\boc\bca\bal\bl2\b2, l\blo\boc\bca\bal\bl3\b3, l\blo\boc\bca\bal\bl4\b4, l\blo\boc\bca\bal\bl5\b5,
1156        l\blo\boc\bca\bal\bl6\b6, and l\blo\boc\bca\bal\bl7\b7.  The following syslog priorities are
1157        supported: a\bal\ble\ber\brt\bt, c\bcr\bri\bit\bt, d\bde\beb\bbu\bug\bg, e\bem\bme\ber\brg\bg, e\ber\brr\br, i\bin\bnf\bfo\bo, n\bno\bot\bti\bic\bce\be,
1158        and w\bwa\bar\brn\bni\bin\bng\bg.
1159
1160 F\bFI\bIL\bLE\bES\bS
1161        _\b/_\be_\bt_\bc_\b/_\bs_\bu_\bd_\bo_\be_\br_\bs         List of who can run what
1162        _\b/_\be_\bt_\bc_\b/_\bg_\br_\bo_\bu_\bp           Local groups file
1163        _\b/_\be_\bt_\bc_\b/_\bn_\be_\bt_\bg_\br_\bo_\bu_\bp        List of network groups
1164
1165 E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
1166        Since the _\bs_\bu_\bd_\bo_\be_\br_\bs file is parsed in a single pass, order
1167        is important.  In general, you should structure _\bs_\bu_\bd_\bo_\be_\br_\bs
1168        such that the Host_Alias, User_Alias, and Cmnd_Alias spec­
1169        ifications come first, followed by any Default_Entry
1170        lines, and finally the Runas_Alias and user specifica­
1171        tions.  The basic rule of thumb is you cannot reference an
1172        Alias that has not already been defined.
1173
1174        Below are example _\bs_\bu_\bd_\bo_\be_\br_\bs entries.  Admittedly, some of
1175        these are a bit contrived.  First, we define our _\ba_\bl_\bi_\ba_\bs_\be_\bs:
1176
1177         # User alias specification
1178         User_Alias     FULLTIMERS = millert, mikef, dowdy
1179         User_Alias     PARTTIMERS = bostley, jwfox, crawl
1180         User_Alias     WEBMASTERS = will, wendy, wim
1181
1182
1183
1184
1185
1186 1.6.9p10                December 17, 2007                      18
1187
1188
1189
1190
1191
1192 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
1193
1194
1195         # Runas alias specification
1196         Runas_Alias    OP = root, operator
1197         Runas_Alias    DB = oracle, sybase
1198
1199         # Host alias specification
1200         Host_Alias     SPARC = bigtime, eclipse, moet, anchor :\
1201                        SGI = grolsch, dandelion, black :\
1202                        ALPHA = widget, thalamus, foobar :\
1203                        HPPA = boa, nag, python
1204         Host_Alias     CUNETS = 128.138.0.0/255.255.0.0
1205         Host_Alias     CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
1206         Host_Alias     SERVERS = master, mail, www, ns
1207         Host_Alias     CDROM = orion, perseus, hercules
1208
1209         # Cmnd alias specification
1210         Cmnd_Alias     DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\
1211                                /usr/sbin/restore, /usr/sbin/rrestore
1212         Cmnd_Alias     KILL = /usr/bin/kill
1213         Cmnd_Alias     PRINTING = /usr/sbin/lpc, /usr/bin/lprm
1214         Cmnd_Alias     SHUTDOWN = /usr/sbin/shutdown
1215         Cmnd_Alias     HALT = /usr/sbin/halt
1216         Cmnd_Alias     REBOOT = /usr/sbin/reboot
1217         Cmnd_Alias     SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh, \
1218                                 /usr/local/bin/tcsh, /usr/bin/rsh, \
1219                                 /usr/local/bin/zsh
1220         Cmnd_Alias     SU = /usr/bin/su
1221         Cmnd_Alias     PAGERS = /usr/bin/more, /usr/bin/pg, /usr/bin/less
1222
1223        Here we override some of the compiled in default values.
1224        We want s\bsu\bud\bdo\bo to log via _\bs_\by_\bs_\bl_\bo_\bg(3) using the _\ba_\bu_\bt_\bh facility
1225        in all cases.  We don't want to subject the full time
1226        staff to the s\bsu\bud\bdo\bo lecture, user m\bmi\bil\bll\ble\ber\brt\bt need not give a
1227        password, and we don't want to reset the LOGNAME, USER or
1228        USERNAME environment variables when running commands as
1229        root.  Additionally, on the machines in the _\bS_\bE_\bR_\bV_\bE_\bR_\bS
1230        Host_Alias, we keep an additional local log file and make
1231        sure we log the year in each log line since the log
1232        entries will be kept around for several years.  Lastly, we
1233        disable shell escapes for the commands in the PAGERS
1234        Cmnd_Alias (_\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bm_\bo_\br_\be, _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bp_\bg and _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bl_\be_\bs_\bs).
1235
1236         # Override built-in defaults
1237         Defaults               syslog=auth
1238         Defaults>root          !set_logname
1239         Defaults:FULLTIMERS    !lecture
1240         Defaults:millert       !authenticate
1241         Defaults@SERVERS       log_year, logfile=/var/log/sudo.log
1242         Defaults!PAGERS        noexec
1243
1244        The _\bU_\bs_\be_\br _\bs_\bp_\be_\bc_\bi_\bf_\bi_\bc_\ba_\bt_\bi_\bo_\bn is the part that actually deter­
1245        mines who may run what.
1246
1247         root           ALL = (ALL) ALL
1248         %wheel         ALL = (ALL) ALL
1249
1250
1251
1252 1.6.9p10                December 17, 2007                      19
1253
1254
1255
1256
1257
1258 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
1259
1260
1261        We let r\bro\boo\bot\bt and any user in group w\bwh\bhe\bee\bel\bl run any command on
1262        any host as any user.
1263
1264         FULLTIMERS     ALL = NOPASSWD: ALL
1265
1266        Full time sysadmins (m\bmi\bil\bll\ble\ber\brt\bt, m\bmi\bik\bke\bef\bf, and d\bdo\bow\bwd\bdy\by) may run
1267        any command on any host without authenticating themselves.
1268
1269         PARTTIMERS     ALL = ALL
1270
1271        Part time sysadmins (b\bbo\bos\bst\btl\ble\bey\by, j\bjw\bwf\bfo\box\bx, and c\bcr\bra\baw\bwl\bl) may run
1272        any command on any host but they must authenticate them­
1273        selves first (since the entry lacks the NOPASSWD tag).
1274
1275         jack           CSNETS = ALL
1276
1277        The user j\bja\bac\bck\bk may run any command on the machines in the
1278        _\bC_\bS_\bN_\bE_\bT_\bS alias (the networks 128.138.243.0, 128.138.204.0,
1279        and 128.138.242.0).  Of those networks, only 128.138.204.0
1280        has an explicit netmask (in CIDR notation) indicating it
1281        is a class C network.  For the other networks in _\bC_\bS_\bN_\bE_\bT_\bS,
1282        the local machine's netmask will be used during matching.
1283
1284         lisa           CUNETS = ALL
1285
1286        The user l\bli\bis\bsa\ba may run any command on any host in the
1287        _\bC_\bU_\bN_\bE_\bT_\bS alias (the class B network 128.138.0.0).
1288
1289         operator       ALL = DUMPS, KILL, SHUTDOWN, HALT, REBOOT, PRINTING,\
1290                        sudoedit /etc/printcap, /usr/oper/bin/
1291
1292        The o\bop\bpe\ber\bra\bat\bto\bor\br user may run commands limited to simple main­
1293        tenance.  Here, those are commands related to backups,
1294        killing processes, the printing system, shutting down the
1295        system, and any commands in the directory _\b/_\bu_\bs_\br_\b/_\bo_\bp_\be_\br_\b/_\bb_\bi_\bn_\b/.
1296
1297         joe            ALL = /usr/bin/su operator
1298
1299        The user j\bjo\boe\be may only _\bs_\bu(1) to operator.
1300
1301         pete           HPPA = /usr/bin/passwd [A-z]*, !/usr/bin/passwd root
1302
1303        The user p\bpe\bet\bte\be is allowed to change anyone's password
1304        except for root on the _\bH_\bP_\bP_\bA machines.  Note that this
1305        assumes _\bp_\ba_\bs_\bs_\bw_\bd(1) does not take multiple usernames on the
1306        command line.
1307
1308         bob            SPARC = (OP) ALL : SGI = (OP) ALL
1309
1310        The user b\bbo\bob\bb may run anything on the _\bS_\bP_\bA_\bR_\bC and _\bS_\bG_\bI
1311        machines as any user listed in the _\bO_\bP Runas_Alias (r\bro\boo\bot\bt
1312        and o\bop\bpe\ber\bra\bat\bto\bor\br).
1313
1314         jim            +biglab = ALL
1315
1316
1317
1318 1.6.9p10                December 17, 2007                      20
1319
1320
1321
1322
1323
1324 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
1325
1326
1327        The user j\bji\bim\bm may run any command on machines in the _\bb_\bi_\bg_\bl_\ba_\bb
1328        netgroup.  s\bsu\bud\bdo\bo knows that "biglab" is a netgroup due to
1329        the '+' prefix.
1330
1331         +secretaries   ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser
1332
1333        Users in the s\bse\bec\bcr\bre\bet\bta\bar\bri\bie\bes\bs netgroup need to help manage the
1334        printers as well as add and remove users, so they are
1335        allowed to run those commands on all machines.
1336
1337         fred           ALL = (DB) NOPASSWD: ALL
1338
1339        The user f\bfr\bre\bed\bd can run commands as any user in the _\bD_\bB
1340        Runas_Alias (o\bor\bra\bac\bcl\ble\be or s\bsy\byb\bba\bas\bse\be) without giving a password.
1341
1342         john           ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*
1343
1344        On the _\bA_\bL_\bP_\bH_\bA machines, user j\bjo\boh\bhn\bn may su to anyone except
1345        root but he is not allowed to give _\bs_\bu(1) any flags.
1346
1347         jen            ALL, !SERVERS = ALL
1348
1349        The user j\bje\ben\bn may run any command on any machine except for
1350        those in the _\bS_\bE_\bR_\bV_\bE_\bR_\bS Host_Alias (master, mail, www and
1351        ns).
1352
1353         jill           SERVERS = /usr/bin/, !SU, !SHELLS
1354
1355        For any machine in the _\bS_\bE_\bR_\bV_\bE_\bR_\bS Host_Alias, j\bji\bil\bll\bl may run
1356        any commands in the directory _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/ except for those
1357        commands belonging to the _\bS_\bU and _\bS_\bH_\bE_\bL_\bL_\bS Cmnd_Aliases.
1358
1359         steve          CSNETS = (operator) /usr/local/op_commands/
1360
1361        The user s\bst\bte\bev\bve\be may run any command in the directory
1362        /usr/local/op_commands/ but only as user operator.
1363
1364         matt           valkyrie = KILL
1365
1366        On his personal workstation, valkyrie, m\bma\bat\btt\bt needs to be
1367        able to kill hung processes.
1368
1369         WEBMASTERS     www = (www) ALL, (root) /usr/bin/su www
1370
1371        On the host www, any user in the _\bW_\bE_\bB_\bM_\bA_\bS_\bT_\bE_\bR_\bS User_Alias
1372        (will, wendy, and wim), may run any command as user www
1373        (which owns the web pages) or simply _\bs_\bu(1) to www.
1374
1375         ALL            CDROM = NOPASSWD: /sbin/umount /CDROM,\
1376                        /sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM
1377
1378        Any user may mount or unmount a CD-ROM on the machines in
1379        the CDROM Host_Alias (orion, perseus, hercules) without
1380        entering a password.  This is a bit tedious for users to
1381
1382
1383
1384 1.6.9p10                December 17, 2007                      21
1385
1386
1387
1388
1389
1390 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
1391
1392
1393        type, so it is a prime candidate for encapsulating in a
1394        shell script.
1395
1396 S\bSE\bEC\bCU\bUR\bRI\bIT\bTY\bY N\bNO\bOT\bTE\bES\bS
1397        It is generally not effective to "subtract" commands from
1398        ALL using the '!' operator.  A user can trivially circum­
1399        vent this by copying the desired command to a different
1400        name and then executing that.  For example:
1401
1402            bill        ALL = ALL, !SU, !SHELLS
1403
1404        Doesn't really prevent b\bbi\bil\bll\bl from running the commands
1405        listed in _\bS_\bU or _\bS_\bH_\bE_\bL_\bL_\bS since he can simply copy those com­
1406        mands to a different name, or use a shell escape from an
1407        editor or other program.  Therefore, these kind of
1408        restrictions should be considered advisory at best (and
1409        reinforced by policy).
1410
1411 P\bPR\bRE\bEV\bVE\bEN\bNT\bTI\bIN\bNG\bG S\bSH\bHE\bEL\bLL\bL E\bES\bSC\bCA\bAP\bPE\bES\bS
1412        Once s\bsu\bud\bdo\bo executes a program, that program is free to do
1413        whatever it pleases, including run other programs.  This
1414        can be a security issue since it is not uncommon for a
1415        program to allow shell escapes, which lets a user bypass
1416        s\bsu\bud\bdo\bo's access control and logging.  Common programs that
1417        permit shell escapes include shells (obviously), editors,
1418        paginators, mail and terminal programs.
1419
1420        There are two basic approaches to this problem:
1421
1422        restrict  Avoid giving users access to commands that allow
1423                  the user to run arbitrary commands.  Many edi­
1424                  tors have a restricted mode where shell escapes
1425                  are disabled, though s\bsu\bud\bdo\boe\bed\bdi\bit\bt is a better solu­
1426                  tion to running editors via s\bsu\bud\bdo\bo.  Due to the
1427                  large number of programs that offer shell
1428                  escapes, restricting users to the set of pro­
1429                  grams that do not if often unworkable.
1430
1431        noexec    Many systems that support shared libraries have
1432                  the ability to override default library func­
1433                  tions by pointing an environment variable (usu­
1434                  ally LD_PRELOAD) to an alternate shared library.
1435                  On such systems, s\bsu\bud\bdo\bo's _\bn_\bo_\be_\bx_\be_\bc functionality can
1436                  be used to prevent a program run by s\bsu\bud\bdo\bo from
1437                  executing any other programs.  Note, however,
1438                  that this applies only to native dynamically-
1439                  linked executables.  Statically-linked executa­
1440                  bles and foreign executables running under
1441                  binary emulation are not affected.
1442
1443                  To tell whether or not s\bsu\bud\bdo\bo supports _\bn_\bo_\be_\bx_\be_\bc, you
1444                  can run the following as root:
1445
1446                      sudo -V | grep "dummy exec"
1447
1448
1449
1450 1.6.9p10                December 17, 2007                      22
1451
1452
1453
1454
1455
1456 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
1457
1458
1459                  If the resulting output contains a line that
1460                  begins with:
1461
1462                      File containing dummy exec functions:
1463
1464                  then s\bsu\bud\bdo\bo may be able to replace the exec family
1465                  of functions in the standard library with its
1466                  own that simply return an error.  Unfortunately,
1467                  there is no foolproof way to know whether or not
1468                  _\bn_\bo_\be_\bx_\be_\bc will work at compile-time.  _\bn_\bo_\be_\bx_\be_\bc should
1469                  work on SunOS, Solaris, *BSD, Linux, IRIX, Tru64
1470                  UNIX, MacOS X, and HP-UX 11.x.  It is known n\bno\bot\bt
1471                  to work on AIX and UnixWare.  _\bn_\bo_\be_\bx_\be_\bc is expected
1472                  to work on most operating systems that support
1473                  the LD_PRELOAD environment variable.  Check your
1474                  operating system's manual pages for the dynamic
1475                  linker (usually ld.so, ld.so.1, dyld, dld.sl,
1476                  rld, or loader) to see if LD_PRELOAD is sup­
1477                  ported.
1478
1479                  To enable _\bn_\bo_\be_\bx_\be_\bc for a command, use the NOEXEC
1480                  tag as documented in the User Specification sec­
1481                  tion above.  Here is that example again:
1482
1483                   aaron  shanty = NOEXEC: /usr/bin/more, /usr/bin/vi
1484
1485                  This allows user a\baa\bar\bro\bon\bn to run _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bm_\bo_\br_\be and
1486                  _\b/_\bu_\bs_\br_\b/_\bb_\bi_\bn_\b/_\bv_\bi with _\bn_\bo_\be_\bx_\be_\bc enabled.  This will pre­
1487                  vent those two commands from executing other
1488                  commands (such as a shell).  If you are unsure
1489                  whether or not your system is capable of sup­
1490                  porting _\bn_\bo_\be_\bx_\be_\bc you can always just try it out
1491                  and see if it works.
1492
1493        Note that restricting shell escapes is not a panacea.
1494        Programs running as root are still capable of many poten­
1495        tially hazardous operations (such as changing or overwrit­
1496        ing files) that could lead to unintended privilege escala­
1497        tion.  In the specific case of an editor, a safer approach
1498        is to give the user permission to run s\bsu\bud\bdo\boe\bed\bdi\bit\bt.
1499
1500 S\bSE\bEE\bE A\bAL\bLS\bSO\bO
1501        _\br_\bs_\bh(1), _\bs_\bu(1), _\bf_\bn_\bm_\ba_\bt_\bc_\bh(3), _\bs_\bu_\bd_\bo(1m), _\bv_\bi_\bs_\bu_\bd_\bo(8)
1502
1503 C\bCA\bAV\bVE\bEA\bAT\bTS\bS
1504        The _\bs_\bu_\bd_\bo_\be_\br_\bs file should a\bal\blw\bwa\bay\bys\bs be edited by the v\bvi\bis\bsu\bud\bdo\bo
1505        command which locks the file and does grammatical check­
1506        ing. It is imperative that _\bs_\bu_\bd_\bo_\be_\br_\bs be free of syntax
1507        errors since s\bsu\bud\bdo\bo will not run with a syntactically incor­
1508        rect _\bs_\bu_\bd_\bo_\be_\br_\bs file.
1509
1510        When using netgroups of machines (as opposed to users), if
1511        you store fully qualified hostnames in the netgroup (as is
1512        usually the case), you either need to have the machine's
1513
1514
1515
1516 1.6.9p10                December 17, 2007                      23
1517
1518
1519
1520
1521
1522 SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
1523
1524
1525        hostname be fully qualified as returned by the hostname
1526        command or use the _\bf_\bq_\bd_\bn option in _\bs_\bu_\bd_\bo_\be_\br_\bs.
1527
1528 B\bBU\bUG\bGS\bS
1529        If you feel you have found a bug in s\bsu\bud\bdo\bo, please submit a
1530        bug report at http://www.sudo.ws/sudo/bugs/
1531
1532 S\bSU\bUP\bPP\bPO\bOR\bRT\bT
1533        Limited free support is available via the sudo-users mail­
1534        ing list, see http://www.sudo.ws/mail­
1535        man/listinfo/sudo-users to subscribe or search the
1536        archives.
1537
1538 D\bDI\bIS\bSC\bCL\bLA\bAI\bIM\bME\bER\bR
1539        s\bsu\bud\bdo\bo is provided ``AS IS'' and any express or implied war­
1540        ranties, including, but not limited to, the implied war­
1541        ranties of merchantability and fitness for a particular
1542        purpose are disclaimed.  See the LICENSE file distributed
1543        with s\bsu\bud\bdo\bo or http://www.sudo.ws/sudo/license.html for com­
1544        plete details.
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582 1.6.9p10                December 17, 2007                      24
1583
1584