]> granicus.if.org Git - sudo/commitdiff
Attempt to clarify how users and groups interact in Runas_Specs
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 3 Feb 2011 18:20:26 +0000 (13:20 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 3 Feb 2011 18:20:26 +0000 (13:20 -0500)
--HG--
branch : 1.7

sudoers.cat
sudoers.man.in
sudoers.pod

index d3fa3c35bdc9af37d58bbaefaf82a7be392d111c..cafd286856b1d10775a7eacd5d0ee660243f4fda 100644 (file)
@@ -61,7 +61,7 @@ D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
 
 
 
-1.7.5b2                  January 28, 2011                       1
+1.7.5b2                 February  3, 2011                       1
 
 
 
@@ -127,7 +127,7 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
 
 
 
-1.7.5b2                  January 28, 2011                       2
+1.7.5b2                 February  3, 2011                       2
 
 
 
@@ -193,7 +193,7 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
 
 
 
-1.7.5b2                  January 28, 2011                       3
+1.7.5b2                 February  3, 2011                       3
 
 
 
@@ -259,7 +259,7 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
 
 
 
-1.7.5b2                  January 28, 2011                       4
+1.7.5b2                 February  3, 2011                       4
 
 
 
@@ -320,12 +320,12 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
        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 -- but only
        as o\bop\bpe\ber\bra\bat\bto\bor\br.  E.g.,
 
-        $ sudo -u operator /bin/ls.
+        $ sudo -u operator /bin/ls
 
 
 
 
-1.7.5b2                  January 28, 2011                       5
+1.7.5b2                 February  3, 2011                       5
 
 
 
@@ -348,13 +348,36 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
         dgb    boulder = (operator : operator) /bin/ls, (root) /bin/kill, \
                /usr/bin/lprm
 
+       Note that while the group portion of the Runas_Spec permits the user to
+       run as command with that group, it does not force the user to do so.
+       If no group is specified on the command line, the command will run with
+       the group listed in the target user's password database entry.  The
+       following would all be permitted by the sudoers entry above:
+
+        $ sudo -u operator /bin/ls
+        $ sudo -u operator -g operator /bin/ls
+        $ sudo -g operator /bin/ls
+
        In the following example, user t\btc\bcm\bm may run commands that access a modem
-       device file with the dialer group.  Note that in this example only the
-       group will be set, the command still runs as user t\btc\bcm\bm.
+       device file with the dialer group.
 
         tcm    boulder = (:dialer) /usr/bin/tip, /usr/bin/cu, \
                /usr/local/bin/minicom
 
+       Note that in this example only the group will be set, the command still
+       runs as user t\btc\bcm\bm.  E.g.
+
+        $ sudo -g dialer /usr/bin/cu
+
+       Multiple users and groups may be present in a Runas_Spec, in which case
+       the user may select any combination of users and groups via the -\b-u\bu and
+       -\b-g\bg options.  In this example:
+
+        alan   ALL = (root, bin : operator, system) ALL
+
+       user a\bal\bla\ban\bn may run any command as either user root or bin, optionally
+       setting the group to operator or system.
+
    S\bSE\bEL\bLi\bin\bnu\bux\bx_\b_S\bSp\bpe\bec\bc
        On systems with SELinux support, _\bs_\bu_\bd_\bo_\be_\br_\bs entries may optionally have an
        SELinux role and/or type associated with a command.  If a role or type
@@ -365,6 +388,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
    T\bTa\bag\bg_\b_S\bSp\bpe\bec\bc
        A command may have zero or more tags associated with it.  There are
        eight possible tag values, NOPASSWD, PASSWD, NOEXEC, EXEC, SETENV,
+
+
+
+1.7.5b2                 February  3, 2011                       6
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        NOSETENV, LOG_INPUT, NOLOG_INPUT, LOG_OUTPUT and NOLOG_OUTPUT.  Once a
        tag is set on a Cmnd, subsequent Cmnds in the Cmnd_Spec_List, inherit
        the tag unless it is overridden by the opposite tag (i.e.: PASSWD
@@ -388,18 +423,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
         ray    rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
 
        Note, however, that the PASSWD tag has no effect on users who are in
-
-
-
-1.7.5b2                  January 28, 2011                       6
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
        the group specified by the _\be_\bx_\be_\bm_\bp_\bt_\b__\bg_\br_\bo_\bu_\bp option.
 
        By default, if the NOPASSWD tag is applied to any of the entries for a
@@ -431,6 +454,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
        restrictions imposed by _\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 users should be allowed to set variables in this manner.
        If the command matched is A\bAL\bLL\bL, the SETENV tag is implied for that
+
+
+
+1.7.5b2                 February  3, 2011                       7
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        command; this default may be overridden by use of the NOSETENV tag.
 
        _\bL_\bO_\bG_\b__\bI_\bN_\bP_\bU_\bT _\ba_\bn_\bd _\bN_\bO_\bL_\bO_\bG_\b__\bI_\bN_\bP_\bU_\bT
@@ -455,17 +490,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
 
        ?       Matches any single character.
 
-
-
-1.7.5b2                  January 28, 2011                       7
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
        [...]   Matches any character in the specified range.
 
        [!...]  Matches any character n\bno\bot\bt in the specified range.
@@ -496,6 +520,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                _\bs_\bu_\bd_\bo_\be_\br_\bs entry it means that command is not allowed to be run
                with a\ban\bny\by arguments.
 
+
+
+
+1.7.5b2                 February  3, 2011                       8
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
    I\bIn\bnc\bcl\blu\bud\bdi\bin\bng\bg o\bot\bth\bhe\ber\br f\bfi\bil\ble\bes\bs f\bfr\bro\bom\bm w\bwi\bit\bth\bhi\bin\bn s\bsu\bud\bdo\boe\ber\brs\bs
        It is possible to include other _\bs_\bu_\bd_\bo_\be_\br_\bs files from within the _\bs_\bu_\bd_\bo_\be_\br_\bs
        file currently being parsed using the #include and #includedir
@@ -521,17 +557,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
 
        #include /etc/sudoers.%h
 
-
-
-1.7.5b2                  January 28, 2011                       8
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
        will cause s\bsu\bud\bdo\bo to include the file _\b/_\be_\bt_\bc_\b/_\bs_\bu_\bd_\bo_\be_\br_\bs_\b._\bx_\be_\br_\bx_\be_\bs.
 
        The #includedir directive can be used to create a _\bs_\bu_\bd_\bo_\b._\bd directory that
@@ -561,6 +586,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
        as a uid).  Both the comment character and any text after it, up to the
        end of the line, are ignored.
 
+
+
+
+1.7.5b2                 February  3, 2011                       9
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        The reserved word A\bAL\bLL\bL is a built-in _\ba_\bl_\bi_\ba_\bs that always causes a match to
        succeed.  It can be used wherever one might otherwise use a Cmnd_Alias,
        User_Alias, Runas_Alias, or Host_Alias.  You should not try to define
@@ -585,19 +622,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
        used as part of a word (e.g. a user name or host name): '@', '!', '=',
        ':', ',', '(', ')', '\'.
 
-
-
-
-
-1.7.5b2                  January 28, 2011                       9
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
 S\bSU\bUD\bDO\bOE\bER\bRS\bS O\bOP\bPT\bTI\bIO\bON\bNS\bS
        s\bsu\bud\bdo\bo's behavior can be modified by Default_Entry lines, as explained
        earlier.  A list of all supported Defaults parameters, grouped by type,
@@ -628,6 +652,18 @@ S\bSU\bUD\bDO\bOE\bER\bRS\bS O\bOP\bPT\bTI\bIO\bON\bNS\bS
                        by default.
 
        compress_io     If set, and s\bsu\bud\bdo\bo is configured to log a command's input
+
+
+
+1.7.5b2                 February  3, 2011                      10
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
                        or output, the I/O logs will be compressed using z\bzl\bli\bib\bb.
                        This flag is _\bo_\bn by default when s\bsu\bud\bdo\bo is compiled with
                        z\bzl\bli\bib\bb support.
@@ -652,18 +688,6 @@ S\bSU\bUD\bDO\bOE\bER\bRS\bS O\bOP\bPT\bTI\bIO\bON\bNS\bS
                        its value will be used for the PATH environment
                        variable.  This flag is _\bo_\bn by default.
 
-
-
-
-1.7.5b2                  January 28, 2011                      10
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
        fast_glob       Normally, s\bsu\bud\bdo\bo uses the _\bg_\bl_\bo_\bb(3) function to do shell-
                        style globbing when matching path names.  However,
                        since it accesses the file system, _\bg_\bl_\bo_\bb(3) can take a
@@ -694,6 +718,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        use a host alias (CNAME entry) due to performance
                        issues and the fact that there is no way to get all
                        aliases from DNS.  If your machine's host name (as
+
+
+
+1.7.5b2                 February  3, 2011                      11
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
                        returned by the hostname command) is already fully
                        qualified you shouldn't need to set _\bf_\bq_\bd_\bn.  This flag is
                        _\bo_\bf_\bf by default.
@@ -718,18 +754,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
        insults         If set, s\bsu\bud\bdo\bo will insult users when they enter an
                        incorrect password.  This flag is _\bo_\bf_\bf by default.
 
-
-
-
-1.7.5b2                  January 28, 2011                      11
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
        log_host        If set, the host name will be logged in the (non-
                        syslog) s\bsu\bud\bdo\bo log file.  This flag is _\bo_\bf_\bf by default.
 
@@ -761,6 +785,17 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        entry or is explicitly denied.  This flag is _\bo_\bf_\bf by
                        default.
 
+
+
+1.7.5b2                 February  3, 2011                      12
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        mail_no_user    If set, mail will be sent to the _\bm_\ba_\bi_\bl_\bt_\bo user if the
                        invoking user is not in the _\bs_\bu_\bd_\bo_\be_\br_\bs file.  This flag is
                        _\bo_\bn by default.
@@ -784,18 +819,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
        passprompt_override
                        The password prompt specified by _\bp_\ba_\bs_\bs_\bp_\br_\bo_\bm_\bp_\bt will
                        normally only be used if the password prompt provided
-
-
-
-1.7.5b2                  January 28, 2011                      12
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
                        by systems such as PAM matches the string "Password:".
                        If _\bp_\ba_\bs_\bs_\bp_\br_\bo_\bm_\bp_\bt_\b__\bo_\bv_\be_\br_\br_\bi_\bd_\be is set, _\bp_\ba_\bs_\bs_\bp_\br_\bo_\bm_\bp_\bt will always
                        be used.  This flag is _\bo_\bf_\bf by default.
@@ -827,6 +850,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        this prevents users from "chaining" s\bsu\bud\bdo\bo commands to
                        get a root shell by doing something like "sudo sudo
                        /bin/sh".  Note, however, that turning off _\br_\bo_\bo_\bt_\b__\bs_\bu_\bd_\bo
+
+
+
+1.7.5b2                 February  3, 2011                      13
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
                        will also prevent root from running s\bsu\bud\bdo\boe\bed\bdi\bit\bt.
                        Disabling _\br_\bo_\bo_\bt_\b__\bs_\bu_\bd_\bo provides no real additional
                        security; it exists purely for historical reasons.
@@ -851,17 +886,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        _\be_\bn_\bv_\b__\br_\be_\bs_\be_\bt is disabled or HOME is present in the
                        _\be_\bn_\bv_\b__\bk_\be_\be_\bp list.  This flag is _\bo_\bf_\bf by default.
 
-
-
-1.7.5b2                  January 28, 2011                      13
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
        set_logname     Normally, s\bsu\bud\bdo\bo will set the LOGNAME, USER and USERNAME
                        environment variables to the name of the target user
                        (usually root unless the -\b-u\bu option is given).  However,
@@ -892,6 +916,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        effective UIDs are set to the target user (root by
                        default).  This option changes that behavior such that
                        the real UID is left as the invoking user's UID.  In
+
+
+
+1.7.5b2                 February  3, 2011                      14
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
                        other words, this makes s\bsu\bud\bdo\bo act as a setuid wrapper.
                        This can be useful on systems that disable some
                        potentially dangerous functionality when a program is
@@ -917,17 +953,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        a unique session ID that is included in the normal s\bsu\bud\bdo\bo
                        log line, prefixed with _\bT_\bS_\bI_\bD_\b=.
 
-
-
-1.7.5b2                  January 28, 2011                      14
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
        log_output      If set, s\bsu\bud\bdo\bo will run the command in a _\bp_\bs_\be_\bu_\bd_\bo _\bt_\bt_\by and
                        log all output that is sent to the screen, similar to
                        the _\bs_\bc_\br_\bi_\bp_\bt(1) command.  If the standard output or
@@ -958,6 +983,17 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        be the union of the user's umask and what is specified
                        in _\bs_\bu_\bd_\bo_\be_\br_\bs.  This flag is _\bo_\bf_\bf by default.
 
+
+
+1.7.5b2                 February  3, 2011                      15
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        use_loginclass  If set, s\bsu\bud\bdo\bo will apply the defaults specified for the
                        target user's login class if one exists.  Only
                        available if s\bsu\bud\bdo\bo is configured with the
@@ -982,18 +1018,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
 
        closefrom       Before it executes a command, s\bsu\bud\bdo\bo will close all open
                        file descriptors other than standard input, standard
-
-
-
-1.7.5b2                  January 28, 2011                      15
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
                        output and standard error (ie: file descriptors 0-2).
                        The _\bc_\bl_\bo_\bs_\be_\bf_\br_\bo_\bm option can be used to specify a different
                        file descriptor at which to start closing.  The default
@@ -1024,6 +1048,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        this to 0 to always prompt for a password.  If set to a
                        value less than 0 the user's timestamp will never
                        expire.  This can be used to allow users to create or
+
+
+
+1.7.5b2                 February  3, 2011                      16
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
                        delete their own timestamps via sudo -v and sudo -k
                        respectively.
 
@@ -1049,17 +1085,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        possible, or the first editor in the list that exists
                        and is executable.  The default is "vi".
 
-
-
-1.7.5b2                  January 28, 2011                      16
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
        iolog_dir       The directory in which to store input/output logs when
                        the _\bl_\bo_\bg_\b__\bi_\bn_\bp_\bu_\bt or _\bl_\bo_\bg_\b__\bo_\bu_\bt_\bp_\bu_\bt options are enabled or when
                        the LOG_INPUT or LOG_OUTPUT tags are present for a
@@ -1089,6 +1114,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                            name
 
                        %p  expanded to the user whose password is being asked
+
+
+
+1.7.5b2                 February  3, 2011                      17
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
                            for (respects the _\br_\bo_\bo_\bt_\bp_\bw, _\bt_\ba_\br_\bg_\be_\bt_\bp_\bw and _\br_\bu_\bn_\ba_\bs_\bp_\bw
                            flags in _\bs_\bu_\bd_\bo_\be_\br_\bs)
 
@@ -1114,18 +1151,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        before any Runas_Alias specifications.
 
        syslog_badpri   Syslog priority to use when user authenticates
-
-
-
-1.7.5b2                  January 28, 2011                      17
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
                        unsuccessfully.  Defaults to alert.
 
        syslog_goodpri  Syslog priority to use when user authenticates
@@ -1155,6 +1180,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                    terminal is available.  This may be the case when s\bsu\bud\bdo\bo is
                    executed from a graphical (as opposed to text-based)
                    application.  The program specified by _\ba_\bs_\bk_\bp_\ba_\bs_\bs should
+
+
+
+1.7.5b2                 February  3, 2011                      18
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
                    display the argument passed to it as the prompt and write
                    the user's password to the standard output.  The value of
                    _\ba_\bs_\bk_\bp_\ba_\bs_\bs may be overridden by the SUDO_ASKPASS environment
@@ -1180,18 +1217,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
 
                    never   Never lecture the user.
 
-
-
-
-1.7.5b2                  January 28, 2011                      18
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
                    once    Only lecture the user the first time they run s\bsu\bud\bdo\bo.
 
                    If no value is specified, a value of _\bo_\bn_\bc_\be is implied.
@@ -1221,6 +1246,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                    never   The user need never enter a password to use the -\b-l\bl
                            option.
 
+
+
+
+1.7.5b2                 February  3, 2011                      19
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
                    If no value is specified, a value of _\ba_\bn_\by is implied.
                    Negating the option results in a value of _\bn_\be_\bv_\be_\br being used.
                    The default value is _\ba_\bn_\by.
@@ -1246,18 +1283,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
        secure_path Path used for every command run from s\bsu\bud\bdo\bo.  If you don't
                    trust the people running s\bsu\bud\bdo\bo to have a sane PATH
                    environment variable you may want to use this.  Another use
-
-
-
-1.7.5b2                  January 28, 2011                      19
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
                    is if you want to have the "root path" be separate from the
                    "user path."  Users in the group specified by the
                    _\be_\bx_\be_\bm_\bp_\bt_\b__\bg_\br_\bo_\bu_\bp option are not affected by _\bs_\be_\bc_\bu_\br_\be_\b__\bp_\ba_\bt_\bh.  This
@@ -1288,6 +1313,17 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                    Negating the option results in a value of _\bn_\be_\bv_\be_\br being used.
                    The default value is _\ba_\bl_\bl.
 
+
+
+1.7.5b2                 February  3, 2011                      20
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        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:
 
        env_check       Environment variables to be removed from the user's
@@ -1312,18 +1348,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                        can be replaced, added to, deleted from, or disabled by
                        using the =, +=, -=, and ! operators respectively.  The
                        default list of environment variables to remove is
-
-
-
-1.7.5b2                  January 28, 2011                      20
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
                        displayed when s\bsu\bud\bdo\bo is run by root with the _\b-_\bV option.
                        Note that many operating systems will remove
                        potentially dangerous variables from the environment of
@@ -1354,6 +1378,18 @@ F\bFI\bIL\bLE\bES\bS
 
        _\b/_\be_\bt_\bc_\b/_\bn_\be_\bt_\bg_\br_\bo_\bu_\bp           List of network groups
 
+
+
+
+1.7.5b2                 February  3, 2011                      21
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        _\b/_\bv_\ba_\br_\b/_\bl_\bo_\bg_\b/_\bs_\bu_\bd_\bo_\b-_\bi_\bo        I/O log files
 
 E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
@@ -1378,18 +1414,6 @@ E\bEX\bXA\bAM\bMP\bPL\bLE\bES\bS
 
         # Host alias specification
         Host_Alias     SPARC = bigtime, eclipse, moet, anchor :\
-
-
-
-1.7.5b2                  January 28, 2011                      21
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
                        SGI = grolsch, dandelion, black :\
                        ALPHA = widget, thalamus, foobar :\
                        HPPA = boa, nag, python
@@ -1420,6 +1444,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
        Additionally, on the machines in the _\bS_\bE_\bR_\bV_\bE_\bR_\bS Host_Alias, we keep an
        additional local log file and make sure we log the year in each log
        line since the log entries will be kept around for several years.
+
+
+
+1.7.5b2                 February  3, 2011                      22
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        Lastly, we disable shell escapes for the commands in the PAGERS
        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).
 
@@ -1445,17 +1481,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
        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 any command on
        any host without authenticating themselves.
 
-
-
-1.7.5b2                  January 28, 2011                      22
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
         PARTTIMERS     ALL = ALL
 
        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 any command on
@@ -1485,6 +1510,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
 
         joe            ALL = /usr/bin/su operator
 
+
+
+
+1.7.5b2                 February  3, 2011                      23
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        The user j\bjo\boe\be may only _\bs_\bu(1) to operator.
 
         pete           HPPA = /usr/bin/passwd [A-Za-z]*, !/usr/bin/passwd root
@@ -1510,18 +1547,6 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
 
         +secretaries   ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser
 
-
-
-
-1.7.5b2                  January 28, 2011                      23
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
        Users in the s\bse\bec\bcr\bre\bet\bta\bar\bri\bie\bes\bs netgroup need to help manage the printers as
        well as add and remove users, so they are allowed to run those commands
        on all machines.
@@ -1552,6 +1577,17 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
        The user s\bst\bte\bev\bve\be may run any command in the directory
        /usr/local/op_commands/ but only as user operator.
 
+
+
+1.7.5b2                 February  3, 2011                      24
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
         matt           valkyrie = KILL
 
        On his personal workstation, valkyrie, m\bma\bat\btt\bt needs to be able to kill
@@ -1577,17 +1613,6 @@ S\bSE\bEC\bCU\bUR\bRI\bIT\bTY\bY N\bNO\bOT\bTE\bES\bS
        desired command to a different name and then executing that.  For
        example:
 
-
-
-1.7.5b2                  January 28, 2011                      24
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
            bill        ALL = ALL, !SU, !SHELLS
 
        Doesn't really prevent b\bbi\bil\bll\bl from running the commands listed in _\bS_\bU or
@@ -1617,6 +1642,18 @@ 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
        since it is not uncommon for a program to allow shell escapes, which
        lets a user bypass s\bsu\bud\bdo\bo's access control and logging.  Common programs
        that permit shell escapes include shells (obviously), editors,
+
+
+
+1.7.5b2                 February  3, 2011                      25
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        paginators, mail and terminal programs.
 
        There are two basic approaches to this problem:
@@ -1643,17 +1680,6 @@ 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
 
                      sudo -V | grep "dummy exec"
 
-
-
-1.7.5b2                  January 28, 2011                      25
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
                  If the resulting output contains a line that begins with:
 
                      File containing dummy exec functions:
@@ -1682,6 +1708,18 @@ SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
                  unsure whether or not your system is capable of supporting
                  _\bn_\bo_\be_\bx_\be_\bc you can always just try it out and see if it works.
 
+
+
+
+1.7.5b2                 February  3, 2011                      26
+
+
+
+
+
+SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
+
+
        Note that restricting shell escapes is not a panacea.  Programs running
        as root are still capable of many potentially hazardous operations
        (such as changing or overwriting files) that could lead to unintended
@@ -1708,18 +1746,6 @@ B\bBU\bUG\bGS\bS
 
 S\bSU\bUP\bPP\bPO\bOR\bRT\bT
        Limited free support is available via the sudo-users mailing list, see
-
-
-
-1.7.5b2                  January 28, 2011                      26
-
-
-
-
-
-SUDOERS(4)             MAINTENANCE COMMANDS            SUDOERS(4)
-
-
        http://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
        the archives.
 
@@ -1751,32 +1777,6 @@ D\bDI\bIS\bSC\bCL\bLA\bAI\bIM\bME\bER\bR
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-1.7.5b2                  January 28, 2011                      27
+1.7.5b2                 February  3, 2011                      27
 
 
index 5cb7678711929e9d3306d55e2fea1c0d8e15eb62..885caa1ebe93a6b899e1a960f82c270f0710d86d 100644 (file)
 .\" ========================================================================
 .\"
 .IX Title "SUDOERS @mansectform@"
-.TH SUDOERS @mansectform@ "January 28, 2011" "1.7.5b2" "MAINTENANCE COMMANDS"
+.TH SUDOERS @mansectform@ "February  3, 2011" "1.7.5b2" "MAINTENANCE COMMANDS"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -460,7 +460,7 @@ The user \fBdgb\fR may run \fI/bin/ls\fR, \fI/bin/kill\fR, and
 \&\fI/usr/bin/lprm\fR \*(-- but only as \fBoperator\fR.  E.g.,
 .PP
 .Vb 1
-\& $ sudo \-u operator /bin/ls.
+\& $ sudo \-u operator /bin/ls
 .Ve
 .PP
 It is also possible to override a \f(CW\*(C`Runas_Spec\*(C'\fR later on in an
@@ -481,14 +481,43 @@ the user or group set to \fBoperator\fR:
 \&        /usr/bin/lprm
 .Ve
 .PP
+Note that while the group portion of the \f(CW\*(C`Runas_Spec\*(C'\fR permits the
+user to run as command with that group, it does not force the user
+to do so.  If no group is specified on the command line, the command
+will run with the group listed in the target user's password database
+entry.  The following would all be permitted by the sudoers entry above:
+.PP
+.Vb 3
+\& $ sudo \-u operator /bin/ls
+\& $ sudo \-u operator \-g operator /bin/ls
+\& $ sudo \-g operator /bin/ls
+.Ve
+.PP
 In the following example, user \fBtcm\fR may run commands that access
-a modem device file with the dialer group.  Note that in this example
-only the group will be set, the command still runs as user \fBtcm\fR.
+a modem device file with the dialer group.
 .PP
 .Vb 2
 \& tcm    boulder = (:dialer) /usr/bin/tip, /usr/bin/cu, \e
 \&        /usr/local/bin/minicom
 .Ve
+.PP
+Note that in this example only the group will be set, the command
+still runs as user \fBtcm\fR.  E.g.
+.PP
+.Vb 1
+\& $ sudo \-g dialer /usr/bin/cu
+.Ve
+.PP
+Multiple users and groups may be present in a \f(CW\*(C`Runas_Spec\*(C'\fR, in
+which case the user may select any combination of users and groups
+via the \fB\-u\fR and \fB\-g\fR options.  In this example:
+.PP
+.Vb 1
+\& alan   ALL = (root, bin : operator, system) ALL
+.Ve
+.PP
+user \fBalan\fR may run any command as either user root or bin,
+optionally setting the group to operator or system.
 .if \n(SL \{\
 .SS "SELinux_Spec"
 .IX Subsection "SELinux_Spec"
index a65a232ec0da343e660623f831b01c76ca353227..3336f46b095f50a348dbd7ea0206c7e7e7024812 100644 (file)
@@ -322,7 +322,7 @@ What this means is that for the entry:
 The user B<dgb> may run F</bin/ls>, F</bin/kill>, and
 F</usr/bin/lprm> -- but only as B<operator>.  E.g.,
 
- $ sudo -u operator /bin/ls.
+ $ sudo -u operator /bin/ls
 
 It is also possible to override a C<Runas_Spec> later on in an
 entry.  If we modify the entry like so:
@@ -338,13 +338,36 @@ the user or group set to B<operator>:
  dgb   boulder = (operator : operator) /bin/ls, (root) /bin/kill, \
        /usr/bin/lprm
 
+Note that while the group portion of the C<Runas_Spec> permits the
+user to run as command with that group, it does not force the user
+to do so.  If no group is specified on the command line, the command
+will run with the group listed in the target user's password database
+entry.  The following would all be permitted by the sudoers entry above:
+
+ $ sudo -u operator /bin/ls
+ $ sudo -u operator -g operator /bin/ls
+ $ sudo -g operator /bin/ls
+
 In the following example, user B<tcm> may run commands that access
-a modem device file with the dialer group.  Note that in this example
-only the group will be set, the command still runs as user B<tcm>.
+a modem device file with the dialer group.
 
  tcm   boulder = (:dialer) /usr/bin/tip, /usr/bin/cu, \
        /usr/local/bin/minicom
 
+Note that in this example only the group will be set, the command
+still runs as user B<tcm>.  E.g.
+
+ $ sudo -g dialer /usr/bin/cu
+
+Multiple users and groups may be present in a C<Runas_Spec>, in
+which case the user may select any combination of users and groups
+via the B<-u> and B<-g> options.  In this example:
+
+ alan  ALL = (root, bin : operator, system) ALL
+
+user B<alan> may run any command as either user root or bin,
+optionally setting the group to operator or system.
+
 =head2 SELinux_Spec
 
 On systems with SELinux support, I<sudoers> entries may optionally have