From 5d0b523ae3aaab7ad151adc8192726c7be321468 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 14 Dec 2001 20:29:19 +0000 Subject: [PATCH] Regen from pod files --- sudo.cat | 166 +++++------ sudo.man.in | 29 +- sudoers.cat | 752 +++++++++++++++++++++++++++---------------------- sudoers.man.in | 156 ++++++---- visudo.cat | 104 +++---- visudo.man.in | 37 ++- 6 files changed, 687 insertions(+), 557 deletions(-) diff --git a/sudo.cat b/sudo.cat index 0858dcc79..2b54f81d9 100644 --- a/sudo.cat +++ b/sudo.cat @@ -23,14 +23,14 @@ DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN this is the user's password, not the root password). Once a user has been authenticated, a timestamp is updated and the user may then use sudo without a password for a short - period of time (`5' minutes unless overridden in _s_u_d_o_e_r_s). + period of time (5 minutes unless overridden in _s_u_d_o_e_r_s). ssssuuuuddddoooo determines who is an authorized user by consulting the file _/_e_t_c_/_s_u_d_o_e_r_s. By giving ssssuuuuddddoooo the ----vvvv flag a user can update the time stamp without running a _c_o_m_m_a_n_d_. The password prompt itself will also time out if the user's - password is not entered within `5' minutes (unless over­ - ridden via _s_u_d_o_e_r_s). + password is not entered within 5 minutes (unless overrid­ + den via _s_u_d_o_e_r_s). If a user who is not listed in the _s_u_d_o_e_r_s file tries to run a command via ssssuuuuddddoooo, mail is sent to the proper author­ @@ -49,19 +49,19 @@ OOOOPPPPTTTTIIIIOOOONNNNSSSS ssssuuuuddddoooo accepts the following command line options: -V The ----VVVV (_v_e_r_s_i_o_n) option causes ssssuuuuddddoooo to print the ver­ - sion number and exit. + sion number and exit. If the invoking user is already + root the ----VVVV option will print out a list of the + defaults ssssuuuuddddoooo was compiled with as well as the + machine's local network addresses. -l The ----llll (_l_i_s_t) option will list out the allowed (and forbidden) commands for the user on the current host. - -L The ----LLLL (_l_i_s_t defaults) option will list out the param­ - eters that may be set in a _D_e_f_a_u_l_t_s line along with a - short description for each. This option is useful in - conjunction with _g_r_e_p(1). -December 29, 2000 1.6.4 1 + +December 14, 2001 1.6.4 1 @@ -70,13 +70,18 @@ December 29, 2000 1.6.4 1 sudo(1m) MAINTENANCE COMMANDS sudo(1m) + -L The ----LLLL (_l_i_s_t defaults) option will list out the param­ + eters that may be set in a _D_e_f_a_u_l_t_s line along with a + short description for each. This option is useful in + conjunction with _g_r_e_p(1). + -h The ----hhhh (_h_e_l_p) option causes ssssuuuuddddoooo to print a usage mes­ sage and exit. -v If given the ----vvvv (_v_a_l_i_d_a_t_e) option, ssssuuuuddddoooo will update the user's timestamp, prompting for the user's pass­ word if necessary. This extends the ssssuuuuddddoooo timeout for - another `5' minutes (or whatever the timeout is set to + another 5 minutes (or whatever the timeout is set to in _s_u_d_o_e_r_s) but does not run a command. -k The ----kkkk (_k_i_l_l) option to ssssuuuuddddoooo invalidates the user's @@ -97,16 +102,16 @@ sudo(1m) MAINTENANCE COMMANDS sudo(1m) -p The ----pppp (_p_r_o_m_p_t) option allows you to override the default password prompt and use a custom one. If the - password prompt contains the `%u' escape, `%u' will be - replaced with the user's login name. Similarly, `%h' + password prompt contains the %u escape, %u will be + replaced with the user's login name. Similarly, %h will be replaced with the local hostname. -c The ----cccc (_c_l_a_s_s) option causes ssssuuuuddddoooo to run the specified command with resources limited by the specified login class. The _c_l_a_s_s argument can be either a class name as defined in /etc/login.conf, or a single '-' charac­ - ter. Specifying a _c_l_a_s_s of `-' indicates that the - command should be run restricted by the default login + ter. Specifying a _c_l_a_s_s of - indicates that the com­ + mand should be run restricted by the default login capabilities for the user the command is run as. If the _c_l_a_s_s argument specifies an existing user class, the command must be run as root, or the ssssuuuuddddoooo command @@ -119,15 +124,10 @@ sudo(1m) MAINTENANCE COMMANDS sudo(1m) the specified authentication type when validating the user, as allowed by /etc/login.conf. The system administrator may specify a list of sudo-specific - authentication methods by adding an "auth-sudo" entry - in /etc/login.conf. This option is only available on - systems that support BSD authentication where ssssuuuuddddoooo has - been configured with the --with-bsdauth option. - -December 29, 2000 1.6.4 2 +December 14, 2001 1.6.4 2 @@ -136,6 +136,11 @@ December 29, 2000 1.6.4 2 sudo(1m) MAINTENANCE COMMANDS sudo(1m) + authentication methods by adding an "auth-sudo" entry + in /etc/login.conf. This option is only available on + systems that support BSD authentication where ssssuuuuddddoooo has + been configured with the --with-bsdauth option. + -u The ----uuuu (_u_s_e_r) option causes ssssuuuuddddoooo to run the specified command as a user other than _r_o_o_t. To specify a _u_i_d instead of a _u_s_e_r_n_a_m_e, use _#_u_i_d. @@ -144,10 +149,10 @@ sudo(1m) MAINTENANCE COMMANDS sudo(1m) _S_H_E_L_L environment variable if it is set or the shell as specified in _p_a_s_s_w_d(4). - -H The ----HHHH (_H_O_M_E) option sets the `HOME' environment vari­ + -H The ----HHHH (_H_O_M_E) option sets the HOME environment vari­ able to the homedir of the target user (root by default) as specified in _p_a_s_s_w_d(4). By default, ssssuuuuddddoooo - does not modify `HOME'. + does not modify HOME. -S The ----SSSS (_s_t_d_i_n) option causes ssssuuuuddddoooo to read the password from standard input instead of the terminal device. @@ -165,35 +170,30 @@ RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEES a configuration/permission problem or if ssssuuuuddddoooo cannot exe­ cute the given command. In the latter case the error string is printed to stderr. If ssssuuuuddddoooo cannot _s_t_a_t(2) one - or more entries in the user's `PATH' an error is printed - on stderr. (If the directory does not exist or if it is - not really a directory, the entry is ignored and no error - is printed.) This should not happen under normal circum­ + or more entries in the user's PATH an error is printed on + stderr. (If the directory does not exist or if it is not + really a directory, the entry is ignored and no error is + printed.) This should not happen under normal circum­ stances. The most common reason for _s_t_a_t(2) to return "permission denied" is if you are running an automounter - and one of the directories in your `PATH' is on a machine + and one of the directories in your PATH is on a machine that is currently unreachable. SSSSEEEECCCCUUUURRRRIIIITTTTYYYY NNNNOOOOTTTTEEEESSSS ssssuuuuddddoooo tries to be safe when executing external commands. Variables that control how dynamic loading and binding is done can be used to subvert the program that ssssuuuuddddoooo runs. - To combat this the `LD_*', `_RLD_*', `SHLIB_PATH' (HP-UX - only), and `LIBPATH' (AIX only) environment variables are - removed from the environment passed on to all commands - executed. ssssuuuuddddoooo will also remove the `IFS', `ENV', - `BASH_ENV', `KRB_CONF', `KRBCONFDIR', `KRBTKFILE', - `KRB5_CONFIG', `LOCALDOMAIN', `RES_OPTIONS', `HOSTAL­ - IASES', `NLSPATH', `PATH_LOCALE', `TERMINFO', `TER­ - MINFO_DIRS' and `TERMPATH' variables as they too can pose - a threat. If the `TERMCAP' variable is set and is a path­ - name, it too is ignored. Additionally, if the `LC_*' or - `LANGUAGE' variables contain the `/' or `%' characters, - they are ignored. If ssssuuuuddddoooo has been compiled with SecurID + To combat this the LD_*, _RLD_*, SHLIB_PATH (HP-UX only), + and LIBPATH (AIX only) environment variables are removed + from the environment passed on to all commands executed. + ssssuuuuddddoooo will also remove the IFS, ENV, BASH_ENV, KRB_CONF, + KRBCONFDIR, KRBTKFILE, KRB5_CONFIG, LOCALDOMAIN, + RES_OPTIONS, HOSTALIASES, NLSPATH, PATH_LOCALE, TERMINFO, + TERMINFO_DIRS and TERMPATH variables as they too can pose -December 29, 2000 1.6.4 3 +December 14, 2001 1.6.4 3 @@ -202,13 +202,18 @@ December 29, 2000 1.6.4 3 sudo(1m) MAINTENANCE COMMANDS sudo(1m) - support, the `VAR_ACE', `USR_ACE' and `DLC_ACE' variables - are cleared as well. + a threat. If the TERMCAP variable is set and is a path­ + name, it too is ignored. Additionally, if the LC_* or + LANGUAGE variables contain the / or % characters, they are + ignored. If ssssuuuuddddoooo has been compiled with SecurID support, + the VAR_ACE, USR_ACE and DLC_ACE variables are cleared as + well. The list of environment variables that ssssuuuuddddoooo clears + is contained in the output of sudo -V when run as root. To prevent command spoofing, ssssuuuuddddoooo checks "." and "" (both denoting current directory) last when searching for a com­ mand in the user's PATH (if one or both are in the PATH). - Note, however, that the actual `PATH' environment variable + Note, however, that the actual PATH environment variable is _n_o_t modified and is passed unchanged to the program that ssssuuuuddddoooo executes. @@ -239,34 +244,44 @@ sudo(1m) MAINTENANCE COMMANDS sudo(1m) ssssuuuuddddoooo will not honor timestamps set far in the future. Timestamps with a date greater than current_time + 2 * - `TIMEOUT' will be ignored and sudo will log and complain. + TIMEOUT will be ignored and sudo will log and complain. This is done to keep a user from creating his/her own timestamp with a bogus date on systems that allow users to give away files. -EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS - Note: the following examples assume suitable _s_u_d_o_e_r_s(4) - entries. + Please note that ssssuuuuddddoooo will only log the command it explic­ + itly runs. If a user runs a command such as sudo su or + sudo sh, subsequent commands run from that shell will _n_o_t + be logged, nor will ssssuuuuddddoooo's access control affect them. + The same is true for commands that offer shell escapes + (including most editors). Because of this, care must be + taken when giving users access to commands via ssssuuuuddddoooo to - To get a file listing of an unreadable directory: - % sudo ls /usr/local/protected - To list the home directory of user yazza on a machine - where the filesystem holding ~yazza is not exported as - root: +December 14, 2001 1.6.4 4 -December 29, 2000 1.6.4 4 +sudo(1m) MAINTENANCE COMMANDS sudo(1m) + verify that the command does not inadvertantly give the + user an effective root shell. +EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS + Note: the following examples assume suitable _s_u_d_o_e_r_s(4) + entries. -sudo(1m) MAINTENANCE COMMANDS sudo(1m) + To get a file listing of an unreadable directory: + + % sudo ls /usr/local/protected + To list the home directory of user yazza on a machine + where the filesystem holding ~yazza is not exported as + root: % sudo -u yazza ls ~yazza @@ -280,7 +295,7 @@ sudo(1m) MAINTENANCE COMMANDS sudo(1m) To make a usage listing of the directories in the /home partition. Note that this runs the commands in a sub- - shell to make the `cd' and file redirection work. + shell to make the cd and file redirection work. % sudo sh -c "cd /home ; du -s * | sort -rn > USAGE" @@ -308,6 +323,17 @@ FFFFIIIILLLLEEEESSSS /var/run/sudo Directory containing timestamps + + +December 14, 2001 1.6.4 5 + + + + + +sudo(1m) MAINTENANCE COMMANDS sudo(1m) + + AAAAUUUUTTTTHHHHOOOORRRRSSSS Many people have worked on ssssuuuuddddoooo over the years; this ver­ sion consists of code written primarily by: @@ -323,17 +349,6 @@ BBBBUUUUGGGGSSSS If you feel you have found a bug in sudo, please submit a bug report at http://www.courtesan.com/sudo/bugs/ - - -December 29, 2000 1.6.4 5 - - - - - -sudo(1m) MAINTENANCE COMMANDS sudo(1m) - - DDDDIIIISSSSCCCCLLLLAAAAIIIIMMMMEEEERRRR SSSSuuuuddddoooo is provided ``AS IS'' and any express or implied war­ ranties, including, but not limited to, the implied war­ @@ -346,7 +361,7 @@ CCCCAAAAVVVVEEEEAAAATTTTSSSS shell if that user has access to commands allowing shell escapes. - If users have sudo `ALL' there is nothing to prevent them + If users have sudo ALL there is nothing to prevent them from creating their own program that gives them a root shell regardless of any '!' elements in the user specifi­ cation. @@ -376,21 +391,6 @@ SSSSEEEEEEEE AAAALLLLSSSSOOOO - - - - - - - - - - - - - - - -December 29, 2000 1.6.4 6 +December 14, 2001 1.6.4 6 diff --git a/sudo.man.in b/sudo.man.in index 5783c9ef9..973788cb9 100644 --- a/sudo.man.in +++ b/sudo.man.in @@ -1,5 +1,5 @@ -.\" Automatically generated by Pod::Man version 1.04 -.\" Fri Dec 29 20:16:40 2000 +.\" Automatically generated by Pod::Man version 1.15 +.\" Fri Dec 14 13:00:22 2001 .\" .\" Standard preamble: .\" ====================================================================== @@ -46,8 +46,8 @@ . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" -. ds C` ` -. ds C' ' +. ds C` +. ds C' 'br\} .el\{\ . ds -- \|\(em\| @@ -63,7 +63,7 @@ .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" -. . +.. . nr % 0 . rr F .\} @@ -138,7 +138,7 @@ .\" ====================================================================== .\" .IX Title "sudo @mansectsu@" -.TH sudo @mansectsu@ "1.6.4" "December 29, 2000" "MAINTENANCE COMMANDS" +.TH sudo @mansectsu@ "1.6.4" "December 14, 2001" "MAINTENANCE COMMANDS" .UC .SH "NAME" sudo \- execute a command as another user @@ -186,7 +186,9 @@ or via the \fIsudoers\fR file. .Ip "\-V" 4 .IX Item "-V" The \fB\-V\fR (\fIversion\fR) option causes \fBsudo\fR to print the -version number and exit. +version number and exit. If the invoking user is already root +the \fB\-V\fR option will print out a list of the defaults \fBsudo\fR +was compiled with as well as the machine's local network addresses. .Ip "\-l" 4 .IX Item "-l" The \fB\-l\fR (\fIlist\fR) option will list out the allowed (and @@ -304,7 +306,9 @@ on to all commands executed. \fBsudo\fR will also remove the \f(CW\*(C`IFS\*(C' Additionally, if the \f(CW\*(C`LC_*\*(C'\fR or \f(CW\*(C`LANGUAGE\*(C'\fR variables contain the \&\f(CW\*(C`/\*(C'\fR or \f(CW\*(C`%\*(C'\fR characters, they are ignored. If \fBsudo\fR has been compiled with SecurID support, the \f(CW\*(C`VAR_ACE\*(C'\fR, \f(CW\*(C`USR_ACE\*(C'\fR and -\&\f(CW\*(C`DLC_ACE\*(C'\fR variables are cleared as well. +\&\f(CW\*(C`DLC_ACE\*(C'\fR variables are cleared as well. The list of environment +variables that \fBsudo\fR clears is contained in the output of +\&\f(CW\*(C`sudo \-V\*(C'\fR when run as root. .PP To prevent command spoofing, \fBsudo\fR checks \*(L".\*(R" and "" (both denoting current directory) last when searching for a command in the user's @@ -339,6 +343,15 @@ Timestamps with a date greater than current_time + 2 * \f(CW\*(C`TIMEOUT\*(C'\fR will be ignored and sudo will log and complain. This is done to keep a user from creating his/her own timestamp with a bogus date on systems that allow users to give away files. +.PP +Please note that \fBsudo\fR will only log the command it explicitly +runs. If a user runs a command such as \f(CW\*(C`sudo su\*(C'\fR or \f(CW\*(C`sudo sh\*(C'\fR, +subsequent commands run from that shell will \fInot\fR be logged, nor +will \fBsudo\fR's access control affect them. The same is true for +commands that offer shell escapes (including most editors). Because +of this, care must be taken when giving users access to commands +via \fBsudo\fR to verify that the command does not inadvertantly give +the user an effective root shell. .SH "EXAMPLES" .IX Header "EXAMPLES" Note: the following examples assume suitable \fIsudoers\fR\|(@mansectform@) entries. diff --git a/sudoers.cat b/sudoers.cat index 93687db75..bba3493f2 100644 --- a/sudoers.cat +++ b/sudoers.cat @@ -8,18 +8,18 @@ NNNNAAAAMMMMEEEE sudoers - list of which users may execute what DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN - The _s_u_d_o_e_r_s file is composed two types of entries: aliases - (basically variables) and user specifications (which spec­ - ify who may run what). The grammar of _s_u_d_o_e_r_s will be - described below in Extended Backus-Naur Form (EBNF). - Don't despair if you don't know what EBNF is, it is fairly - simple and the definitions below are annotated. + The _s_u_d_o_e_r_s file is composed of two types of entries: + aliases (basically variables) and user specifications + (which specify who may run what). The grammar of _s_u_d_o_e_r_s + will be described below in Extended Backus-Naur Form + (EBNF). Don't despair if you don't know what EBNF is; it + is fairly simple, and the definitions below are annotated. QQQQuuuuiiiicccckkkk gggguuuuiiiiddddeeee ttttoooo EEEEBBBBNNNNFFFF EBNF is a concise and exact way of describing the grammar of a language. Each EBNF definition is made up of _p_r_o_d_u_c_­ - _t_i_o_n _r_u_l_e_s. Eg. + _t_i_o_n _r_u_l_e_s. E.g., symbol ::= definition | alternate1 | alternate2 ... @@ -29,14 +29,14 @@ DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN ular expressions. Do not, however, confuse them with "wildcard" characters, which have different meanings. - `?' Means that the preceding symbol (or group of sym­ + ? Means that the preceding symbol (or group of sym­ bols) is optional. That is, it may appear once or not at all. - `*' Means that the preceding symbol (or group of sym­ + * Means that the preceding symbol (or group of sym­ bols) may appear zero or more times. - `+' Means that the preceding symbol (or group of sym­ + + Means that the preceding symbol (or group of sym­ bols) may appear one or more times. Parentheses may be used to group symbols together. For @@ -46,13 +46,13 @@ DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN AAAAlllliiiiaaaasssseeeessss - There are four kinds of aliases: the `User_Alias', - `Runas_Alias', `Host_Alias' and `Cmnd_Alias'. + There are four kinds of aliases: User_Alias, Runas_Alias, + Host_Alias and Cmnd_Alias. - Alias ::= 'User_Alias' = User_Alias (':' User_Alias)* | - 'Runas_Alias' = Runas_Alias (':' Runas_Alias)* | - 'Host_Alias' = Host_Alias (':' Host_Alias)* | - 'Cmnd_Alias' = Cmnd_Alias (':' Cmnd_Alias)* + Alias ::= 'User_Alias' User_Alias (':' User_Alias)* | + 'Runas_Alias' Runas_Alias (':' Runas_Alias)* | + 'Host_Alias' Host_Alias (':' Host_Alias)* | + 'Cmnd_Alias' Cmnd_Alias (':' Cmnd_Alias)* User_Alias ::= NAME '=' User_List @@ -61,7 +61,7 @@ DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN -December 29, 2000 1.6.4 1 +December 13, 2001 1.6.4 1 @@ -80,12 +80,12 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) Alias_Type NAME = item1, item2, ... - where _A_l_i_a_s___T_y_p_e is one of `User_Alias', `Runas_Alias', - `Host_Alias', or `Cmnd_Alias'. A `NAME' is a string of - upper case letters, numbers, and the underscore characters - ('_'). A `NAME' mmmmuuuusssstttt start with an upper case letter. It - is possible to put several alias definitions of the same - type on a single line, joined by a colon (':'). Eg. + where _A_l_i_a_s___T_y_p_e is one of User_Alias, Runas_Alias, + Host_Alias, or Cmnd_Alias. A NAME is a string of upper­ + case letters, numbers, and the underscore characters + ('_'). A NAME mmmmuuuusssstttt start with an uppercase letter. It is + possible to put several alias definitions of the same type + on a single line, joined by a colon (':'). E.g., Alias_Type NAME = item1, item2, item3 : NAME = item4, item5 @@ -101,11 +101,11 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) '!'* '+'netgroup | '!'* User_Alias - A `User_List' is made up of one or more usernames, uids + A User_List is made up of one or more usernames, uids (prefixed with '#'), System groups (prefixed with '%'), netgroups (prefixed with '+') and other aliases. Each list item may be prefixed with one or more '!' operators. - An odd number of '!' operators negates the value of the + An odd number of '!' operators negate the value of the item; an even number just cancel each other out. Runas_List ::= Runas_User | @@ -117,9 +117,9 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) '!'* +netgroup | '!'* Runas_Alias - Likewise, a `Runas_List' has the same possible elements as - a `User_List', except that it can include a `Runas_Alias', - instead of a `User_Alias'. + Likewise, a Runas_List has the same possible elements as a + User_List, except that it can include a Runas_Alias, + instead of a User_Alias. Host_List ::= Host | Host ',' Host_List @@ -127,7 +127,7 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) -December 29, 2000 1.6.4 2 +December 13, 2001 1.6.4 2 @@ -142,19 +142,19 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) '!'* '+'netgroup | '!'* Host_Alias - A `Host_List' is made up of one or more hostnames, IP + A Host_List is made up of one or more hostnames, IP addresses, network numbers, netgroups (prefixed with '+') and other aliases. Again, the value of an item may be negated with the '!' operator. If you do not specify a netmask with a network number, the netmask of the host's ethernet _i_n_t_e_r_f_a_c_e(s) will be used when matching. The netmask may be specified either in dotted quad notation - (eg. 255.255.255.0) or CIDR notation (number of bits, eg. - 24). A hostname may include shell-style wildcards (see - `Wildcards' section below), but unless the `hostname' com­ - mand on your machine returns the fully qualified hostname, - you'll need to use the _f_q_d_n option for wildcards to be - useful. + (e.g. 255.255.255.0) or CIDR notation (number of bits, + e.g. 24). A hostname may include shell-style wildcards + (see `Wildcards' section below), but unless the hostname + command on your machine returns the fully qualified host­ + name, you'll need to use the _f_q_d_n option for wildcards to + be useful. Cmnd_List ::= Cmnd | Cmnd ',' Cmnd_List @@ -167,23 +167,22 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) '!'* directory | '!'* Cmnd_Alias - A `Cmnd_List' is a list of one or more commandnames, - directories, and other aliases. A commandname is a fully - qualified filename which may include shell-style wildcards + A Cmnd_List is a list of one or more commandnames, direc­ + tories, and other aliases. A commandname is a fully qual­ + ified filename which may include shell-style wildcards (see `Wildcards' section below). A simple filename allows the user to run the command with any arguments he/she - wishes. However, you may also command line arguments - (including wildcards). Alternately, you can specify `""' - to indicate that the command may only be run wwwwiiiitttthhhhoooouuuutttt com­ - mand line arguments. A directory is a fully qualified + wishes. However, you may also specify command line argu­ + ments (including wildcards). Alternately, you can specify + "" to indicate that the command may only be run wwwwiiiitttthhhhoooouuuutttt + command line arguments. A directory is a fully qualified pathname ending in a '/'. When you specify a directory in - a `Cmnd_List', the user will be able to run any file - within that directory (but not in any subdirectories - therein). + a Cmnd_List, the user will be able to run any file within + that directory (but not in any subdirectories therein). - If a `Cmnd' has associated command line arguments, then - the arguments in the `Cmnd' must match exactly those given - by the user on the command line (or match the wildcards if + If a Cmnd has associated command line arguments, then the + arguments in the Cmnd must match exactly those given by + the user on the command line (or match the wildcards if there are any). Note that the following characters must be escaped with a '\' if they are used in command argu­ ments: ',', ':', '=', '\'. @@ -193,7 +192,8 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) -December 29, 2000 1.6.4 3 + +December 13, 2001 1.6.4 3 @@ -205,7 +205,7 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) DDDDeeeeffffaaaauuuullllttttssss Certain configuration options may be changed from their - default values at runtime via one or more `Default_Entry' + default values at runtime via one or more Default_Entry lines. These may affect all users on any host, all users on a specific host, or just a specific user. When multi­ ple entries match, they are applied in order. Where there @@ -219,15 +219,22 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) Default_Entry ::= Default_Type Parameter_List Parameter ::= Parameter '=' Value || + Parameter '+=' Value || + Parameter '-=' Value || '!'* Parameter || - Parameters may be ffffllllaaaaggggssss, iiiinnnntttteeeeggggeeeerrrr values, or ssssttttrrrriiiinnnnggggssss. - Flags are implicitly boolean and can be turned off via the - '!' operator. Some integer and string parameters may also - be used in a boolean context to disable them. Values may - be enclosed in double quotes (`"') when they contain mul­ - tiple words. Special characters may be escaped with a - backslash (`\'). + Parameters may be ffffllllaaaaggggssss, iiiinnnntttteeeeggggeeeerrrr values, ssssttttrrrriiiinnnnggggssss, or + lllliiiissssttttssss. Flags are implicitly boolean and can be turned off + via the '!' operator. Some integer, string and list + parameters may also be used in a boolean context to dis­ + able them. Values may be enclosed in double quotes (") + when they contain multiple words. Special characters may + be escaped with a backslash (\). + + Lists have two additional assignment operators, += and -=. + These operators are used to add to and delete from a list + respectively. It is not an error to use the -= operator + to remove an element that does not exist in a list. FFFFllllaaaaggggssss: @@ -240,26 +247,19 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) more convenient. This flag is _o_f_f by default. ignore_dot If set, ssssuuuuddddoooo will ignore '.' or '' (current - dir) in the `PATH' environment variable; the - `PATH' itself is not modified. This flag is - _o_f_f by default. + dir) in the PATH environment variable; the + PATH itself is not modified. This flag is _o_f_f + by default. mail_always Send mail to the _m_a_i_l_t_o user every time a users runs ssssuuuuddddoooo. This flag is _o_f_f by default. - mail_no_user - If set, mail will be sent to the _m_a_i_l_t_o user - if the invoking user is not in the _s_u_d_o_e_r_s - file. This flag is _o_n by default. - - mail_no_host - If set, mail will be sent to the _m_a_i_l_t_o user - if the invoking user exists in the _s_u_d_o_e_r_s - file, but is not allowed to run commands on + mail_badpass + Send mail to the _m_a_i_l_t_o user if the user -December 29, 2000 1.6.4 4 +December 13, 2001 1.6.4 4 @@ -268,6 +268,18 @@ December 29, 2000 1.6.4 4 sudoers(4) MAINTENANCE COMMANDS sudoers(4) + running sudo does not enter the correct pass­ + word. This flag is _o_f_f by default. + + mail_no_user + If set, mail will be sent to the _m_a_i_l_t_o user + if the invoking user is not in the _s_u_d_o_e_r_s + file. This flag is _o_n by default. + + mail_no_host + If set, mail will be sent to the _m_a_i_l_t_o user + if the invoking user exists in the _s_u_d_o_e_r_s + file, but is not allowed to run commands on the current host. This flag is _o_f_f by default. @@ -294,14 +306,14 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) If set, users must authenticate themselves via a password (or other means of authentication) before they may run commands. This default - may be overridden via the `PASSWD' and - `NOPASSWD' tags. This flag is _o_n by default. + may be overridden via the PASSWD and NOPASSWD + tags. This flag is _o_n by default. root_sudo If set, root is allowed to run ssssuuuuddddoooo too. Dis­ abling this prevents users from "chaining" ssssuuuuddddoooo commands to get a root shell by doing - something like `"sudo sudo /bin/sh"'. This - flag is _o_n by default. + something like "sudo sudo /bin/sh". This flag + is _o_n by default. log_host If set, the hostname will be logged in the (non-syslog) ssssuuuuddddoooo log file. This flag is _o_f_f @@ -311,21 +323,9 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) the (non-syslog) ssssuuuuddddoooo log file. This flag is _o_f_f by default. - shell_noargs - If set and ssssuuuuddddoooo is invoked with no arguments - it acts as if the ----ssss flag had been given. - That is, it runs a shell as root (the shell is - determined by the `SHELL' environment variable - if it is set, falling back on the shell listed - in the invoking user's /etc/passwd entry if - not). This flag is _o_f_f by default. - - set_home If set and ssssuuuuddddoooo is invoked with the ----ssss flag - the `HOME' environment variable will be set to - -December 29, 2000 1.6.4 5 +December 13, 2001 1.6.4 5 @@ -334,13 +334,24 @@ December 29, 2000 1.6.4 5 sudoers(4) MAINTENANCE COMMANDS sudoers(4) + shell_noargs + If set and ssssuuuuddddoooo is invoked with no arguments + it acts as if the ----ssss flag had been given. + That is, it runs a shell as root (the shell is + determined by the SHELL environment variable + if it is set, falling back on the shell listed + in the invoking user's /etc/passwd entry if + not). This flag is _o_f_f by default. + + set_home If set and ssssuuuuddddoooo is invoked with the ----ssss flag + the HOME environment variable will be set to the home directory of the target user (which is root unless the ----uuuu option is used). This effectively makes the ----ssss flag imply ----HHHH. This flag is _o_f_f by default. always_set_home - If set, ssssuuuuddddoooo will set the `HOME' environment + If set, ssssuuuuddddoooo will set the HOME environment variable to the home directory of the target user (which is root unless the ----uuuu option is used). This effectively means that the ----HHHH @@ -348,19 +359,18 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) default. path_info Normally, ssssuuuuddddoooo will tell the user when a com­ - mand could not be found in their `PATH' envi­ - ronment variable. Some sites may wish to dis­ - able this as it could be used to gather infor­ - mation on the location of executables that the - normal user does not have access to. The dis­ - advantage is that if the executable is simply - not in the user's `PATH', ssssuuuuddddoooo will tell the - user that they are not allowed to run it, - which can be confusing. This flag is off by - default. + mand could not be found in their PATH environ­ + ment variable. Some sites may wish to disable + this as it could be used to gather information + on the location of executables that the normal + user does not have access to. The disadvan­ + tage is that if the executable is simply not + in the user's PATH, ssssuuuuddddoooo will tell the user + that they are not allowed to run it, which can + be confusing. This flag is off by default. fqdn Set this flag if you want to put fully quali­ - fied hostnames in the _s_u_d_o_e_r_s file. Ie: + fied hostnames in the _s_u_d_o_e_r_s file. I.e.: instead of myhost you would use myhost.mydo­ main.edu. You may still use the short form if you wish (and even mix the two). Beware that @@ -370,28 +380,18 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) not plugged into the network). Also note that you must use the host's official name as DNS knows it. That is, you may not 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 - hostname (as returned by the `hostname' com­ - mand) is already fully qualified you shouldn't - need to set _f_q_d_n. This flag is _o_f_f by - default. + 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 hostname + (as returned by the hostname command) is + already fully qualified you shouldn't need to + set _f_q_d_n. This flag is _o_f_f by default. - insults If set, ssssuuuuddddoooo will insult users when they enter - an incorrect password. This flag is _o_f_f by - default. - requiretty If set, ssssuuuuddddoooo will only run when the user is - logged in to a real tty. This will disallow - things like `"rsh somehost sudo ls"' since - _r_s_h(1) does not allocate a tty. Because it is - not possible to turn of echo when there is no - tty present, some sites may with to set this -December 29, 2000 1.6.4 6 +December 13, 2001 1.6.4 6 @@ -400,6 +400,16 @@ December 29, 2000 1.6.4 6 sudoers(4) MAINTENANCE COMMANDS sudoers(4) + insults If set, ssssuuuuddddoooo will insult users when they enter + an incorrect password. This flag is _o_f_f by + default. + + requiretty If set, ssssuuuuddddoooo will only run when the user is + logged in to a real tty. This will disallow + things like "rsh somehost sudo ls" since + _r_s_h(1) does not allocate a tty. Because it is + not possible to turn of echo when there is no + tty present, some sites may with to set this flag to prevent a user from entering a visible password. This flag is _o_f_f by default. @@ -410,10 +420,10 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) allows the user to run any arbitrary command as root without logging. A safer alternative is to place a colon-separated list of editors - in the `editor' variable. vvvviiiissssuuuuddddoooo will then - only use the EDITOR or VISUAL if they match a - value specified in `editor'. This flag is - `off' by default. + in the editor variable. vvvviiiissssuuuuddddoooo will then only + use the EDITOR or VISUAL if they match a value + specified in editor. This flag is off by + default. rootpw If set, ssssuuuuddddoooo will prompt for the root password instead of the password of the invoking user. @@ -421,43 +431,33 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) runaspw If set, ssssuuuuddddoooo will prompt for the password of the user defined by the _r_u_n_a_s___d_e_f_a_u_l_t option - (defaults to `root') instead of the password - of the invoking user. This flag is _o_f_f by + (defaults to root) instead of the password of + the invoking user. This flag is _o_f_f by default. targetpw If set, ssssuuuuddddoooo will prompt for the password of the user specified by the ----uuuu flag (defaults to - `root') instead of the password of the invok­ - ing user. This flag is _o_f_f by default. - - set_logname Normally, ssssuuuuddddoooo will set the `LOGNAME' and - `USER' environment variables to the name of - the target user (usually root unless the ----uuuu - flag is given). However, since some programs - (including the RCS revision control system) - use `LOGNAME' to determine the real identity - of the user, it may be desirable to change - this behavior. This can be done by negating - the set_logname option. + root) instead of the password of the invoking + user. This flag is _o_f_f by default. + + set_logname Normally, ssssuuuuddddoooo will set the LOGNAME and USER + environment variables to the name of the tar­ + get user (usually root unless the ----uuuu flag is + given). However, since some programs (includ­ + ing the RCS revision control system) use LOG­ + NAME to determine the real identity of the + user, it may be desirable to change this + behavior. This can be done by negating the + set_logname option. stay_setuid Normally, when ssssuuuuddddoooo executes a command the real and 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 other words, - this makes ssssuuuuddddoooo act as a setuid wrapper. This - can be useful on systems that disable some - potentially dangerous functionality when a - program is run setuid. - - env_reset If set, ssssuuuuddddoooo will reset the environment to - only contain the following variables: `HOME', - `SHELL', `LOGNAME', and `USER' (in addition to - the `SUDO_*' variables). The `PATH' and -December 29, 2000 1.6.4 7 +December 13, 2001 1.6.4 7 @@ -466,9 +466,24 @@ December 29, 2000 1.6.4 7 sudoers(4) MAINTENANCE COMMANDS sudoers(4) - `TERM' environment variables are preserved - unaltered. Other specific variables may be - preserved with the i option. + as the invoking user's UID. In other words, + this makes ssssuuuuddddoooo act as a setuid wrapper. This + can be useful on systems that disable some + potentially dangerous functionality when a + program is run setuid. + + env_reset If set, ssssuuuuddddoooo will reset the environment to + only contain the following variables: HOME, + LOGNAME, PATH, SHELL, TERM, and USER (in addi­ + tion to the SUDO_* variables). Of these, only + TERM is copied unaltered from the old environ­ + ment. The other variables are set to default + values (possibly modified by the value of the + _s_e_t___l_o_g_n_a_m_e option). If ssssuuuuddddoooo was compiled + with the SECURE_PATH option, its value will be + used for the PATH environment variable. Other + variables may be preserved with the + i option. use_loginclass If set, ssssuuuuddddoooo will apply the defaults specified @@ -482,7 +497,7 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) passwd_tries The number of tries a user gets to enter his/her password before ssssuuuuddddoooo logs the failure - and exits. The default is `3'. + and exits. The default is 3. IIIInnnntttteeeeggggeeeerrrrssss tttthhhhaaaatttt ccccaaaannnn bbbbeeee uuuusssseeeedddd iiiinnnn aaaa bbbboooooooolllleeeeaaaannnn ccccoooonnnntttteeeexxxxtttt: @@ -490,47 +505,51 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) log. This value is used to decide when to wrap lines for nicer log files. This has no effect on the syslog log file, only the file - log. The default is `80' (use 0 or negate the + log. The default is 80 (use 0 or negate the option to disable word wrap). timestamp_timeout Number of minutes that can elapse before ssssuuuuddddoooo will ask for a passwd again. The default is - `5', set this to `0' to always prompt for a - password. + 5. Set this to 0 to always prompt for a pass­ + word. 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 delete + their own timestamps via sudo -v and sudo -k + respectively. passwd_timeout Number of minutes before the ssssuuuuddddoooo password - prompt times out. The default is `5', set - this to `0' for no password timeout. - umask Umask to use when running the command. Negate - this option or set it to 0777 to preserve the - user's umask. The default is `0022'. - SSSSttttrrrriiiinnnnggggssss: - mailsub Subject of the mail sent to the _m_a_i_l_t_o user. - The escape `%h' will expand to the hostname of - the machine. Default is `*** SECURITY infor­ - mation for %h ***'. +December 13, 2001 1.6.4 8 - badpass_message - Message that is displayed if a user enters an - incorrect password. The default is `Sorry, - try again.' unless insults are enabled. -December 29, 2000 1.6.4 8 +sudoers(4) MAINTENANCE COMMANDS sudoers(4) + prompt times out. The default is 5, set this + to 0 for no password timeout. + umask Umask to use when running the command. Negate + this option or set it to 0777 to preserve the + user's umask. The default is 0022. + SSSSttttrrrriiiinnnnggggssss: -sudoers(4) MAINTENANCE COMMANDS sudoers(4) + mailsub Subject of the mail sent to the _m_a_i_l_t_o user. + The escape %h will expand to the hostname of + the machine. Default is *** SECURITY informa­ + tion for %h ***. + badpass_message + Message that is displayed if a user enters an + incorrect password. The default is Sorry, try + again. unless insults are enabled. timestampdir The directory in which ssssuuuuddddoooo stores its times­ @@ -538,34 +557,23 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) passprompt The default prompt to use when asking for a password; can be overridden via the ----pppp option - or the `SUDO_PROMPT' environment variable. - Supports two escapes: "%u" expands to the - user's login name and "%h" expands to the - local hostname. The default value is `Pass­ - word:'. + or the SUDO_PROMPT environment variable. Sup­ + ports two escapes: "%u" expands to the user's + login name and "%h" expands to the local host­ + name. The default value is Password:. runas_default The default user to run commands as if the ----uuuu flag is not specified on the command line. - This defaults to `root'. + This defaults to root. syslog_goodpri Syslog priority to use when user authenticates - successfully. Defaults to `notice'. + successfully. Defaults to notice. syslog_badpri Syslog priority to use when user authenticates - unsuccessfully. Defaults to `alert'. - - env_keep A double-quoted, space-separated list of envi­ - ronment variables to be preserved in the - user's environment. When used in conjuction - with the _e_n_v___r_e_s_e_t option, this allows fine - control over the environment ssssuuuuddddoooo-spawned pro­ - cesses will get. If the _e_n_v___r_e_s_e_t option is - not used, _e_n_v___k_e_e_p can be used to make excep­ - tions to the built in list of "dangerous" - environment variables. + unsuccessfully. Defaults to alert. editor A colon (':') separated list of editors allowed to be used with vvvviiiissssuuuuddddoooo. vvvviiiissssuuuuddddoooo will @@ -577,26 +585,26 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) SSSSttttrrrriiiinnnnggggssss tttthhhhaaaatttt ccccaaaannnn bbbbeeee uuuusssseeeedddd iiiinnnn aaaa bbbboooooooolllleeeeaaaannnn ccccoooonnnntttteeeexxxxtttt: - logfile Path to the ssssuuuuddddoooo log file (not the syslog log - file). Setting a path turns on logging to a - file, negating this option turns it off. - syslog Syslog facility if syslog is being used for - logging (negate to disable syslog logging). - Defaults to `local2'. +December 13, 2001 1.6.4 9 -December 29, 2000 1.6.4 9 +sudoers(4) MAINTENANCE COMMANDS sudoers(4) -sudoers(4) MAINTENANCE COMMANDS sudoers(4) + logfile Path to the ssssuuuuddddoooo log file (not the syslog log + file). Setting a path turns on logging to a + file; negating this option turns it off. + syslog Syslog facility if syslog is being used for + logging (negate to disable syslog logging). + Defaults to local2. mailerpath Path to mail program used to send warning mail. Defaults to the path to sendmail found @@ -605,23 +613,16 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) mailerflags Flags to use when invoking mailer. Defaults to ----tttt. - mailto Address to send warning and erorr mail to. + mailto Address to send warning and error mail to. The address should be enclosed in double - quotes (`"') to protect against sudo inter­ - preting the `@' sign. Defaults to `root'. + quotes (") to protect against sudo interpret­ + ing the @ sign. Defaults to root. exempt_group Users in this group are exempt from password and PATH requirements. This is not set by default. - secure_path Path used for every command run from ssssuuuuddddoooo. If - you don't trust the people running ssssuuuuddddoooo to - have a sane `PATH' environment variable you - may want to use this. Another use is if you - want to have the "root path" be separate from - the "user path." This is not set by default. - verifypw This option controls when a password will be required when a user runs ssssuuuuddddoooo with the ----vvvv flag. It has the following possible values: @@ -654,8 +655,7 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) - -December 29, 2000 1.6.4 10 +December 13, 2001 1.6.4 10 @@ -677,6 +677,39 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) The default value is `any'. + LLLLiiiissssttttssss tttthhhhaaaatttt ccccaaaannnn bbbbeeee uuuusssseeeedddd iiiinnnn aaaa bbbboooooooolllleeeeaaaannnn ccccoooonnnntttteeeexxxxtttt: + + env_check A double-quoted, space-separated list of envi­ + ronment variables to be removed from the + user's environment if the variable's value + contains % or / characters. This can be used + to guard against printf-style format vulnera­ + bilties in poorly-written programs. The list + can be replaced, added to, deleted from, or + disabled by using the =, +=, -=, and oper­ + ators respectively. The default list of envi­ + ronment variable to check is printed when ssssuuuuddddoooo + is run by root with the _-_V option. + + env_delete A double-quoted, space-separated list of envi­ + ronment variables to be removed from the + user's environment. The list can be replaced, + added to, deleted from, or disabled by using + the =, +=, -=, and operators respectively. + The default list of environment variable to + remove is printed when ssssuuuuddddoooo is run by root + with the _-_V option. + + env_keep A double-quoted, space-separated list of envi­ + ronment variables to be preserved in the + user's environment when the _e_n_v___r_e_s_e_t option + is in effect. This allows fine-grained con­ + trol over the environment ssssuuuuddddoooo-spawned pro­ + cesses will get. The list can be replaced, + added to, deleted from, or disabled by using + the =, +=, -=, and operators respectively. + This list has no default members. + When logging via _s_y_s_l_o_g(3), ssssuuuuddddoooo accepts the following values for the syslog facility (the value of the ssssyyyysssslllloooogggg Parameter): aaaauuuutttthhhhpppprrrriiiivvvv (if your OS supports it), aaaauuuutttthhhh, ddddaaaaeeee­­­­ @@ -685,9 +718,21 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) supported: aaaalllleeeerrrrtttt, ccccrrrriiiitttt, ddddeeeebbbbuuuugggg, eeeemmmmeeeerrrrgggg, eeeerrrrrrrr, iiiinnnnffffoooo, nnnnoooottttiiiicccceeee, and wwwwaaaarrrrnnnniiiinnnngggg. + + + +December 13, 2001 1.6.4 11 + + + + + +sudoers(4) MAINTENANCE COMMANDS sudoers(4) + + UUUUsssseeeerrrr SSSSppppeeeecccciiiiffffiiiiccccaaaattttiiiioooonnnn - User_Spec ::= User_list Host_List '=' User_List Cmnd_Spec_List \ + User_Spec ::= User_list Host_List '=' Cmnd_Spec_List \ (':' User_Spec)* Cmnd_Spec_List ::= Cmnd_Spec | @@ -699,57 +744,57 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) A uuuusssseeeerrrr ssssppppeeeecccciiiiffffiiiiccccaaaattttiiiioooonnnn determines which commands a user may run (and as what user) on specified hosts. By default, - commands are run as rrrrooooooootttt but this can be changed on a per- - command basis. + commands are run as rrrrooooooootttt, but this can be changed on a + per-command basis. Let's break that down into its constituent parts: RRRRuuuunnnnaaaassss____SSSSppppeeeecccc - A `Runas_Spec' is simply a `Runas_List' (as defined above) + A Runas_Spec is simply a Runas_List (as defined above) enclosed in a set of parentheses. If you do not specify a - `Runas_Spec' in the user specification, a default - `Runas_Spec' of rrrrooooooootttt will be used. A `Runas_Spec' sets - the default for commands that follow it. What this means - is that for the entry: + Runas_Spec in the user specification, a default Runas_Spec + of rrrrooooooootttt will be used. A Runas_Spec sets the default for + commands that follow it. What this means is that for the + entry: dgb boulder = (operator) /bin/ls, /bin/kill, /usr/bin/who The user ddddggggbbbb may run _/_b_i_n_/_l_s, _/_b_i_n_/_k_i_l_l, and _/_u_s_r_/_b_i_n_/_l_p_r_m - -- but only as ooooppppeeeerrrraaaattttoooorrrr. Eg. + -- but only as ooooppppeeeerrrraaaattttoooorrrr. E.g., + sudo -u operator /bin/ls. + It is also possible to override a Runas_Spec later on in + an entry. If we modify the entry like so: + dgb boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm -December 29, 2000 1.6.4 11 + Then user ddddggggbbbb is now allowed to run _/_b_i_n_/_l_s as ooooppppeeeerrrraaaattttoooorrrr, + but _/_b_i_n_/_k_i_l_l and _/_u_s_r_/_b_i_n_/_l_p_r_m as rrrrooooooootttt. + NNNNOOOOPPPPAAAASSSSSSSSWWWWDDDD aaaannnndddd PPPPAAAASSSSSSSSWWWWDDDD + By default, ssssuuuuddddoooo requires that a user authenticate him or + herself before running a command. This behavior can be + modified via the NOPASSWD tag. Like a Runas_Spec, the + NOPASSWD tag sets a default for the commands that follow + it in the Cmnd_Spec_List. Conversely, the PASSWD tag can + be used to reverse things. For example: + ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm -sudoers(4) MAINTENANCE COMMANDS sudoers(4) - sudo -u operator /bin/ls. +December 13, 2001 1.6.4 12 - It is also possible to override a `Runas_Spec' later on in - an entry. If we modify the entry like so: - dgb boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm - Then user ddddggggbbbb is now allowed to run _/_b_i_n_/_l_s as ooooppppeeeerrrraaaattttoooorrrr, - but _/_b_i_n_/_k_i_l_l and _/_u_s_r_/_b_i_n_/_l_p_r_m as rrrrooooooootttt. - NNNNOOOOPPPPAAAASSSSSSSSWWWWDDDD aaaannnndddd PPPPAAAASSSSSSSSWWWWDDDD - By default, ssssuuuuddddoooo requires that a user authenticate him or - herself before running a command. This behavior can be - modified via the `NOPASSWD' tag. Like a `Runas_Spec', the - `NOPASSWD' tag sets a default for the commands that follow - it in the `Cmnd_Spec_List'. Conversely, the `PASSWD' tag - can be used to reverse things. For example: +sudoers(4) MAINTENANCE COMMANDS sudoers(4) - ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm would allow the user rrrraaaayyyy to run _/_b_i_n_/_k_i_l_l, _/_b_i_n_/_l_s, and _/_u_s_r_/_b_i_n_/_l_p_r_m as root on the machine rushmore as rrrrooooooootttt @@ -759,47 +804,33 @@ 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 + Note, however, that the PASSWD tag has no effect on users who are in the group specified by the exempt_group option. - By default, if the `NOPASSWD' tag is applied to any of the + By default, if the NOPASSWD tag is applied to any of the entries for a user on the current host, he or she will be - able to run `sudo -l' without a password. Additionally, a - user may only run `sudo -v' without a password if the - `NOPASSWD' tag is present for all a user's entries that - pertain to the current host. This behavior may be over­ - ridden via the verifypw and listpw options. + able to run sudo -l without a password. Additionally, a + user may only run sudo -v without a password if the + NOPASSWD tag is present for all a user's entries that per­ + tain to the current host. This behavior may be overridden + via the verifypw and listpw options. WWWWiiiillllddddccccaaaarrrrddddssss ((((aaaakkkkaaaa mmmmeeeettttaaaa cccchhhhaaaarrrraaaacccctttteeeerrrrssss)))):::: ssssuuuuddddoooo allows shell-style _w_i_l_d_c_a_r_d_s to be used in pathnames as well as command line arguments in the _s_u_d_o_e_r_s file. - Wildcard matching is done via the PPPPOOOOSSSSIIIIXXXX `fnmatch(3)' rou­ + Wildcard matching is done via the PPPPOOOOSSSSIIIIXXXX fnmatch(3) rou­ tine. Note that these are _n_o_t regular expressions. - `*' Matches any set of zero or more characters. - - `?' Matches any single character. - - `[...]' Matches any character in the specified range. - - - + * Matches any set of zero or more characters. + ? Matches any single character. -December 29, 2000 1.6.4 12 + [...] Matches any character in the specified range. + [!...] Matches any character nnnnooootttt in the specified range. - - - -sudoers(4) MAINTENANCE COMMANDS sudoers(4) - - - `[!...]' - Matches any character nnnnooootttt in the specified range. - - `\x' For any character "x", evaluates to "x". This is + \x For any character "x", evaluates to "x". This is used to escape special characters such as: "*", "?", "[", and "}". @@ -810,16 +841,27 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) /usr/bin/* - match `/usr/bin/who' but not `/usr/bin/X11/xterm'. + match /usr/bin/who but not /usr/bin/X11/xterm. EEEExxxxcccceeeeppppttttiiiioooonnnnssss ttttoooo wwwwiiiillllddddccccaaaarrrrdddd rrrruuuulllleeeessss:::: The following exceptions apply to the above rules: - `""""' If the empty string `""' is the only command line + """" If the empty string "" is the only command line argument in the _s_u_d_o_e_r_s entry it means that com­ mand is not allowed to be run with aaaannnnyyyy arguments. + + +December 13, 2001 1.6.4 13 + + + + + +sudoers(4) MAINTENANCE COMMANDS sudoers(4) + + OOOOtttthhhheeeerrrr ssssppppeeeecccciiiiaaaallll cccchhhhaaaarrrraaaacccctttteeeerrrrssss aaaannnndddd rrrreeeesssseeeerrrrvvvveeeedddd wwwwoooorrrrddddssss:::: The pound sign ('#') is used to indicate a comment (unless @@ -830,41 +872,30 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) The reserved word AAAALLLLLLLL is a built in _a_l_i_a_s 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 your own _a_l_i_a_s called AAAALLLLLLLL as the built in alias - will be used in preference to your own. Please note that - using AAAALLLLLLLL can be dangerous since in a command context, it - allows the user to run aaaannnnyyyy command on the system. + might otherwise use a Cmnd_Alias, User_Alias, Runas_Alias, + or Host_Alias. You should not try to define your own + _a_l_i_a_s called AAAALLLLLLLL as the built in alias will be used in + preference to your own. Please note that using AAAALLLLLLLL can be + dangerous since in a command context, it allows the user + to run aaaannnnyyyy command on the system. An exclamation point ('!') can be used as a logical _n_o_t - operator both in an _a_l_i_a_s and in front of a `Cmnd'. This + operator both in an _a_l_i_a_s and in front of a Cmnd. This allows one to exclude certain values. Note, however, that - using a `!' in conjunction with the built in `ALL' alias - to allow a user to run "all but a few" commands rarely - works as intended (see SECURITY NOTES below). + using a ! in conjunction with the built in ALL alias to + allow a user to run "all but a few" commands rarely works + as intended (see SECURITY NOTES below). Long lines can be continued with a backslash ('\') as the last character on the line. - Whitespace between elements in a list as well as specicial + Whitespace between elements in a list as well as special syntactic characters in a _U_s_e_r _S_p_e_c_i_f_i_c_a_t_i_o_n ('=', ':', '(', ')') is optional. - - -December 29, 2000 1.6.4 13 - - - - - -sudoers(4) MAINTENANCE COMMANDS sudoers(4) - - The following characters must be escaped with a backslash - ('\') when used as part of a word (eg. a username or host­ - name): '@', '!', '=', ':', ',', '(', ')', '\'. + ('\') when used as part of a word (e.g. a username or + hostname): '@', '!', '=', ':', ',', '(', ')', '\'. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS Below are example _s_u_d_o_e_r_s entries. Admittedly, some of @@ -879,6 +910,24 @@ EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS Runas_Alias OP = root, operator Runas_Alias DB = oracle, sybase + + + + + + + + + +December 13, 2001 1.6.4 14 + + + + + +sudoers(4) MAINTENANCE COMMANDS sudoers(4) + + # Host alias specification Host_Alias SPARC = bigtime, eclipse, moet, anchor :\ SGI = grolsch, dandelion, black :\ @@ -907,8 +956,8 @@ EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS in all cases. We don't want to subject the full time staff to the ssssuuuuddddoooo lecture, and user mmmmiiiilllllllleeeerrrrtttt need not give a password. In addition, on the machines in the _S_E_R_V_E_R_S - `Host_Alias', we keep an additional local log file and - make sure we log the year in each log line since the log + 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. # Override built in defaults @@ -917,17 +966,6 @@ EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS Defaults:millert !authenticate Defaults@SERVERS log_year, logfile=/var/log/sudo.log - - -December 29, 2000 1.6.4 14 - - - - - -sudoers(4) MAINTENANCE COMMANDS sudoers(4) - - The _U_s_e_r _s_p_e_c_i_f_i_c_a_t_i_o_n is the part that actually deter­ mines who may run what. @@ -944,24 +982,35 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) PARTTIMERS ALL = ALL + + + +December 13, 2001 1.6.4 15 + + + + + +sudoers(4) MAINTENANCE COMMANDS sudoers(4) + + Part time sysadmins (bbbboooossssttttlllleeeeyyyy, jjjjwwwwffffooooxxxx, and ccccrrrraaaawwwwllll) may run any command on any host but they must authenticate them­ - selves first (since the entry lacks the `NOPASSWD' tag). + selves first (since the entry lacks the NOPASSWD tag). jack CSNETS = ALL The user jjjjaaaacccckkkk may run any command on the machines in the - _C_S_N_E_T_S alias (the networks `128.138.243.0', - `128.138.204.0', and `128.138.242.0'). Of those networks, - only <128.138.204.0> has an explicit netmask (in CIDR - notation) indicating it is a class C network. For the - other networks in _C_S_N_E_T_S, the local machine's netmask will - be used during matching. + _C_S_N_E_T_S alias (the networks 128.138.243.0, 128.138.204.0, + and 128.138.242.0). Of those networks, only 128.138.204.0 + has an explicit netmask (in CIDR notation) indicating it + is a class C network. For the other networks in _C_S_N_E_T_S, + the local machine's netmask will be used during matching. lisa CUNETS = ALL The user lllliiiissssaaaa may run any command on any host in the - _C_U_N_E_T_S alias (the class B network `128.138.0.0'). + _C_U_N_E_T_S alias (the class B network 128.138.0.0). operator ALL = DUMPS, KILL, PRINTING, SHUTDOWN, HALT, REBOOT,\ /usr/oper/bin/ @@ -982,22 +1031,10 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) assumes _p_a_s_s_w_d(1) does not take multiple usernames on the command line. - - - -December 29, 2000 1.6.4 15 - - - - - -sudoers(4) MAINTENANCE COMMANDS sudoers(4) - - bob SPARC = (OP) ALL : SGI = (OP) ALL The user bbbboooobbbb may run anything on the _S_P_A_R_C and _S_G_I - machines as any user listed in the _O_P `Runas_Alias' (rrrrooooooootttt + machines as any user listed in the _O_P Runas_Alias (rrrrooooooootttt and ooooppppeeeerrrraaaattttoooorrrr). jim +biglab = ALL @@ -1012,11 +1049,21 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) printers as well as add and remove users, so they are allowed to run those commands on all machines. + + +December 13, 2001 1.6.4 16 + + + + + +sudoers(4) MAINTENANCE COMMANDS sudoers(4) + + fred ALL = (DB) NOPASSWD: ALL The user ffffrrrreeeedddd can run commands as any user in the _D_B - `Runas_Alias' (oooorrrraaaacccclllleeee or ssssyyyybbbbaaaasssseeee) without giving a pass­ - word. + Runas_Alias (oooorrrraaaacccclllleeee or ssssyyyybbbbaaaasssseeee) without giving a password. john ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root* @@ -1026,14 +1073,14 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) jen ALL, !SERVERS = ALL The user jjjjeeeennnn may run any command on any machine except for - those in the _S_E_R_V_E_R_S `Host_Alias' (master, mail, www and + those in the _S_E_R_V_E_R_S Host_Alias (master, mail, www and ns). jill SERVERS = /usr/bin/, !SU, !SHELLS - For any machine in the _S_E_R_V_E_R_S `Host_Alias', jjjjiiiillllllll may run + For any machine in the _S_E_R_V_E_R_S Host_Alias, jjjjiiiillllllll may run any commands in the directory /usr/bin/ except for those - commands belonging to the _S_U and _S_H_E_L_L_S `Cmnd_Aliases'. + commands belonging to the _S_U and _S_H_E_L_L_S Cmnd_Aliases. steve CSNETS = (operator) /usr/local/op_commands/ @@ -1047,19 +1094,7 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) WEBMASTERS www = (www) ALL, (root) /usr/bin/su www - On the host www, any user in the _W_E_B_M_A_S_T_E_R_S `User_Alias' - - - -December 29, 2000 1.6.4 16 - - - - - -sudoers(4) MAINTENANCE COMMANDS sudoers(4) - - + On the host www, any user in the _W_E_B_M_A_S_T_E_R_S User_Alias (will, wendy, and wim), may run any command as user www (which owns the web pages) or simply _s_u(1) to www. @@ -1067,19 +1102,30 @@ sudoers(4) MAINTENANCE COMMANDS sudoers(4) /sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM Any user may mount or unmount a CD-ROM on the machines in - the CDROM `Host_Alias' (orion, perseus, hercules) without + the CDROM Host_Alias (orion, perseus, hercules) without entering a password. This is a bit tedious for users to - type, so it is a prime candiate for encapsulating in a + type, so it is a prime candidate for encapsulating in a shell script. SSSSEEEECCCCUUUURRRRIIIITTTTYYYY NNNNOOOOTTTTEEEESSSS It is generally not effective to "subtract" commands from - `ALL' using the '!' operator. A user can trivially cir­ - cumvent this by copying the desired command to a different + ALL using the '!' operator. A user can trivially circum­ + vent this by copying the desired command to a different name and then executing that. For example: bill ALL = ALL, !SU, !SHELLS + + +December 13, 2001 1.6.4 17 + + + + + +sudoers(4) MAINTENANCE COMMANDS sudoers(4) + + Doesn't really prevent bbbbiiiillllllll from running the commands listed in _S_U or _S_H_E_L_L_S since he can simply copy those com­ mands to a different name, or use a shell escape from an @@ -1097,7 +1143,7 @@ CCCCAAAAVVVVEEEEAAAATTTTSSSS When using netgroups of machines (as opposed to users), if you store fully qualified hostnames in the netgroup (as is usually the case), you either need to have the machine's - hostname be fully qualified as returned by the `hostname' + hostname be fully qualified as returned by the hostname command or use the _f_q_d_n option in _s_u_d_o_e_r_s. FFFFIIIILLLLEEEESSSS @@ -1117,6 +1163,26 @@ SSSSEEEEEEEE AAAALLLLSSSSOOOO -December 29, 2000 1.6.4 17 + + + + + + + + + + + + + + + + + + + + +December 13, 2001 1.6.4 18 diff --git a/sudoers.man.in b/sudoers.man.in index 47a3f23e0..4c0d69f85 100644 --- a/sudoers.man.in +++ b/sudoers.man.in @@ -1,5 +1,5 @@ -.\" Automatically generated by Pod::Man version 1.04 -.\" Fri Dec 29 20:44:35 2000 +.\" Automatically generated by Pod::Man version 1.15 +.\" Thu Dec 13 23:43:32 2001 .\" .\" Standard preamble: .\" ====================================================================== @@ -46,8 +46,8 @@ . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" -. ds C` ` -. ds C' ' +. ds C` +. ds C' 'br\} .el\{\ . ds -- \|\(em\| @@ -63,7 +63,7 @@ .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" -. . +.. . nr % 0 . rr F .\} @@ -138,22 +138,22 @@ .\" ====================================================================== .\" .IX Title "sudoers @mansectform@" -.TH sudoers @mansectform@ "1.6.4" "December 29, 2000" "MAINTENANCE COMMANDS" +.TH sudoers @mansectform@ "1.6.4" "December 13, 2001" "MAINTENANCE COMMANDS" .UC .SH "NAME" sudoers \- list of which users may execute what .SH "DESCRIPTION" .IX Header "DESCRIPTION" -The \fIsudoers\fR file is composed two types of entries: +The \fIsudoers\fR file is composed of two types of entries: aliases (basically variables) and user specifications (which specify who may run what). The grammar of \fIsudoers\fR will be described below in Extended Backus-Naur Form (\s-1EBNF\s0). -Don't despair if you don't know what \s-1EBNF\s0 is, it is fairly -simple and the definitions below are annotated. +Don't despair if you don't know what \s-1EBNF\s0 is; it is fairly +simple, and the definitions below are annotated. .Sh "Quick guide to \s-1EBNF\s0" .IX Subsection "Quick guide to EBNF" \&\s-1EBNF\s0 is a concise and exact way of describing the grammar of a language. -Each \s-1EBNF\s0 definition is made up of \fIproduction rules\fR. Eg. +Each \s-1EBNF\s0 definition is made up of \fIproduction rules\fR. E.g., .PP .Vb 1 \& symbol ::= definition | alternate1 | alternate2 ... @@ -181,14 +181,14 @@ we will use single quotes ('') to designate what is a verbatim character string (as opposed to a symbol name). .Sh "Aliases" .IX Subsection "Aliases" -There are four kinds of aliases: the \f(CW\*(C`User_Alias\*(C'\fR, \f(CW\*(C`Runas_Alias\*(C'\fR, +There are four kinds of aliases: \f(CW\*(C`User_Alias\*(C'\fR, \f(CW\*(C`Runas_Alias\*(C'\fR, \&\f(CW\*(C`Host_Alias\*(C'\fR and \f(CW\*(C`Cmnd_Alias\*(C'\fR. .PP .Vb 4 -\& Alias ::= 'User_Alias' = User_Alias (':' User_Alias)* | -\& 'Runas_Alias' = Runas_Alias (':' Runas_Alias)* | -\& 'Host_Alias' = Host_Alias (':' Host_Alias)* | -\& 'Cmnd_Alias' = Cmnd_Alias (':' Cmnd_Alias)* +\& Alias ::= 'User_Alias' User_Alias (':' User_Alias)* | +\& 'Runas_Alias' Runas_Alias (':' Runas_Alias)* | +\& 'Host_Alias' Host_Alias (':' Host_Alias)* | +\& 'Cmnd_Alias' Cmnd_Alias (':' Cmnd_Alias)* .Ve .Vb 1 \& User_Alias ::= NAME '=' User_List @@ -211,10 +211,10 @@ Each \fIalias\fR definition is of the form \& Alias_Type NAME = item1, item2, ... .Ve where \fIAlias_Type\fR is one of \f(CW\*(C`User_Alias\*(C'\fR, \f(CW\*(C`Runas_Alias\*(C'\fR, \f(CW\*(C`Host_Alias\*(C'\fR, -or \f(CW\*(C`Cmnd_Alias\*(C'\fR. A \f(CW\*(C`NAME\*(C'\fR is a string of upper case letters, numbers, +or \f(CW\*(C`Cmnd_Alias\*(C'\fR. A \f(CW\*(C`NAME\*(C'\fR is a string of uppercase letters, numbers, and the underscore characters ('_'). A \f(CW\*(C`NAME\*(C'\fR \fBmust\fR start with an -upper case letter. It is possible to put several alias definitions -of the same type on a single line, joined by a colon (':'). Eg. +uppercase letter. It is possible to put several alias definitions +of the same type on a single line, joined by a colon (':'). E.g., .PP .Vb 1 \& Alias_Type NAME = item1, item2, item3 : NAME = item4, item5 @@ -236,7 +236,7 @@ A \f(CW\*(C`User_List\*(C'\fR is made up of one or more usernames, uids (prefixed with '#'), System groups (prefixed with '%'), netgroups (prefixed with '+') and other aliases. Each list item may be prefixed with one or more '!' operators. An odd number -of '!' operators negates the value of the item; an even number +of '!' operators negate the value of the item; an even number just cancel each other out. .PP .Vb 2 @@ -270,8 +270,8 @@ network numbers, netgroups (prefixed with '+') and other aliases. Again, the value of an item may be negated with the '!' operator. If you do not specify a netmask with a network number, the netmask of the host's ethernet \fIinterface\fR\|(s) will be used when matching. -The netmask may be specified either in dotted quad notation (eg. -255.255.255.0) or \s-1CIDR\s0 notation (number of bits, eg. 24). A hostname +The netmask may be specified either in dotted quad notation (e.g. +255.255.255.0) or \s-1CIDR\s0 notation (number of bits, e.g. 24). A hostname may include shell-style wildcards (see `Wildcards' section below), but unless the \f(CW\*(C`hostname\*(C'\fR command on your machine returns the fully qualified hostname, you'll need to use the \fIfqdn\fR option for wildcards @@ -295,8 +295,8 @@ A \f(CW\*(C`Cmnd_List\*(C'\fR is a list of one or more commandnames, directories aliases. A commandname is a fully qualified filename which may include shell-style wildcards (see `Wildcards' section below). A simple filename allows the user to run the command with any arguments he/she -wishes. However, you may also command line arguments (including wildcards). -Alternately, you can specify \f(CW\*(C`""\*(C'\fR to indicate that the command +wishes. However, you may also specify command line arguments (including +wildcards). Alternately, you can specify \f(CW\*(C`""\*(C'\fR to indicate that the command may only be run \fBwithout\fR command line arguments. A directory is a fully qualified pathname ending in a '/'. When you specify a directory in a \f(CW\*(C`Cmnd_List\*(C'\fR, the user will be able to run any file within that directory @@ -324,16 +324,23 @@ value on a matching line takes effect. .Vb 1 \& Default_Entry ::= Default_Type Parameter_List .Ve -.Vb 2 +.Vb 4 \& Parameter ::= Parameter '=' Value || +\& Parameter '+=' Value || +\& Parameter '-=' Value || \& '!'* Parameter || .Ve -Parameters may be \fBflags\fR, \fBinteger\fR values, or \fBstrings\fR. Flags -are implicitly boolean and can be turned off via the '!' operator. -Some integer and string parameters may also be used in a boolean -context to disable them. Values may be enclosed in double quotes -(\f(CW\*(C`"\*(C'\fR) when they contain multiple words. Special characters may -be escaped with a backslash (\f(CW\*(C`\e\*(C'\fR). +Parameters may be \fBflags\fR, \fBinteger\fR values, \fBstrings\fR, or \fBlists\fR. +Flags are implicitly boolean and can be turned off via the '!' +operator. Some integer, string and list parameters may also be +used in a boolean context to disable them. Values may be enclosed +in double quotes (\f(CW\*(C`"\*(C'\fR) when they contain multiple words. Special +characters may be escaped with a backslash (\f(CW\*(C`\e\*(C'\fR). +.PP +Lists have two additional assignment operators, \f(CW\*(C`+=\*(C'\fR and \f(CW\*(C`\-=\*(C'\fR. +These operators are used to add to and delete from a list respectively. +It is not an error to use the \f(CW\*(C`\-=\*(C'\fR operator to remove an element +that does not exist in a list. .PP \&\fBFlags\fR: .Ip "long_otp_prompt" 12 @@ -352,6 +359,10 @@ flag is \fI@ignore_dot@\fR by default. .IX Item "mail_always" Send mail to the \fImailto\fR user every time a users runs \fBsudo\fR. This flag is \fIoff\fR by default. +.Ip "mail_badpass" 12 +.IX Item "mail_badpass" +Send mail to the \fImailto\fR user if the user running sudo does not +enter the correct password. This flag is \fIoff\fR by default. .Ip "mail_no_user" 12 .IX Item "mail_no_user" If set, mail will be sent to the \fImailto\fR user if the invoking @@ -431,7 +442,7 @@ default. .Ip "fqdn" 12 .IX Item "fqdn" Set this flag if you want to put fully qualified hostnames in the -\&\fIsudoers\fR file. Ie: instead of myhost you would use myhost.mydomain.edu. +\&\fIsudoers\fR file. I.e.: instead of myhost you would use myhost.mydomain.edu. You may still use the short form if you wish (and even mix the two). Beware that turning on \fIfqdn\fR requires \fBsudo\fR to make \s-1DNS\s0 lookups which may make \fBsudo\fR unusable if \s-1DNS\s0 stops working (for example @@ -496,10 +507,14 @@ dangerous functionality when a program is run setuid. .Ip "env_reset" 12 .IX Item "env_reset" If set, \fBsudo\fR will reset the environment to only contain the -following variables: \f(CW\*(C`HOME\*(C'\fR, \f(CW\*(C`SHELL\*(C'\fR, \f(CW\*(C`LOGNAME\*(C'\fR, and \f(CW\*(C`USER\*(C'\fR -(in addition to the \f(CW\*(C`SUDO_*\*(C'\fR variables). The \f(CW\*(C`PATH\*(C'\fR and \f(CW\*(C`TERM\*(C'\fR -environment variables are preserved unaltered. Other specific variables -may be preserved with the i option. +following variables: \f(CW\*(C`HOME\*(C'\fR, \f(CW\*(C`LOGNAME\*(C'\fR, \f(CW\*(C`PATH\*(C'\fR, \f(CW\*(C`SHELL\*(C'\fR, \f(CW\*(C`TERM\*(C'\fR, +and \f(CW\*(C`USER\*(C'\fR (in addition to the \f(CW\*(C`SUDO_*\*(C'\fR variables). +Of these, only \f(CW\*(C`TERM\*(C'\fR is copied unaltered from the old environment. +The other variables are set to default values (possibly modified +by the value of the \fIset_logname\fR option). If \fBsudo\fR was compiled +with the \f(CW\*(C`SECURE_PATH\*(C'\fR option, its value will be used for the \f(CW\*(C`PATH\*(C'\fR +environment variable. +Other variables may be preserved with the i option. .Ip "use_loginclass" 12 .IX Item "use_loginclass" If set, \fBsudo\fR will apply the defaults specified for the target user's @@ -522,8 +537,11 @@ effect on the syslog log file, only the file log. The default is .Ip "timestamp_timeout" 12 .IX Item "timestamp_timeout" Number of minutes that can elapse before \fBsudo\fR will ask for a -passwd again. The default is \f(CW\*(C`@timeout@\*(C'\fR, set this to \f(CW\*(C`0\*(C'\fR to always +passwd again. The default is \f(CW\*(C`@timeout@\*(C'\fR. Set this to \f(CW\*(C`0\*(C'\fR to always prompt for a password. +If set to a value less than \f(CW\*(C`0\*(C'\fR the user's timestamp will never +expire. This can be used to allow users to create or delete their +own timestamps via \f(CW\*(C`sudo \-v\*(C'\fR and \f(CW\*(C`sudo \-k\*(C'\fR respectively. .Ip "passwd_timeout" 12 .IX Item "passwd_timeout" Number of minutes before the \fBsudo\fR password prompt times out. @@ -565,14 +583,6 @@ Defaults to \f(CW\*(C`@goodpri@\*(C'\fR. .IX Item "syslog_badpri" Syslog priority to use when user authenticates unsuccessfully. Defaults to \f(CW\*(C`@badpri@\*(C'\fR. -.Ip "env_keep" 12 -.IX Item "env_keep" -A double-quoted, space-separated list of environment variables -to be preserved in the user's environment. When used in conjuction -with the \fIenv_reset\fR option, this allows fine control over the -environment \fBsudo\fR\-spawned processes will get. If the \fIenv_reset\fR -option is not used, \fIenv_keep\fR can be used to make exceptions to -the built in list of \*(L"dangerous\*(R" environment variables. .Ip "editor" 12 .IX Item "editor" A colon (':') separated list of editors allowed to be used with @@ -585,7 +595,7 @@ on your system. .Ip "logfile" 12 .IX Item "logfile" Path to the \fBsudo\fR log file (not the syslog log file). Setting a path -turns on logging to a file, negating this option turns it off. +turns on logging to a file; negating this option turns it off. .Ip "syslog" 12 .IX Item "syslog" Syslog facility if syslog is being used for logging (negate to @@ -599,19 +609,13 @@ Defaults to the path to sendmail found at configure time. Flags to use when invoking mailer. Defaults to \fB\-t\fR. .Ip "mailto" 12 .IX Item "mailto" -Address to send warning and erorr mail to. The address should +Address to send warning and error mail to. The address should be enclosed in double quotes (\f(CW\*(C`"\*(C'\fR) to protect against sudo interpreting the \f(CW\*(C`@\*(C'\fR sign. Defaults to \f(CW\*(C`@mailto@\*(C'\fR. .Ip "exempt_group" 12 .IX Item "exempt_group" Users in this group are exempt from password and \s-1PATH\s0 requirements. This is not set by default. -.Ip "secure_path" 12 -.IX Item "secure_path" -Path used for every command run from \fBsudo\fR. If you don't trust the -people running \fBsudo\fR to have a sane \f(CW\*(C`PATH\*(C'\fR environment variable you may -want to use this. Another use is if you want to have the \*(L"root path\*(R" -be separate from the \*(L"user path.\*(R" This is not set by default. .Ip "verifypw" 12 .IX Item "verifypw" This option controls when a password will be required when a user runs @@ -663,6 +667,34 @@ user runs \fBsudo\fR with the \fB\-l\fR. It has the following possible values: .Ve The default value is `any'. .PP +\&\fBLists that can be used in a boolean context\fR: +.Ip "env_check" 12 +.IX Item "env_check" +A double-quoted, space-separated list of environment variables to +be removed from the user's environment if the variable's value +contains \f(CW\*(C`%\*(C'\fR or \f(CW\*(C`/\*(C'\fR characters. This can be used to guard against +printf-style format vulnerabilties in poorly-written programs. The +list can be replaced, added to, deleted from, or disabled by using +the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and operators respectively. The default +list of environment variable to check is printed when \fBsudo\fR is +run by root with the \fI\-V\fR option. +.Ip "env_delete" 12 +.IX Item "env_delete" +A double-quoted, space-separated list of environment variables to +be removed from the user's environment. The list can be replaced, +added to, deleted from, or disabled by using the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, +and operators respectively. The default list of environment +variable to remove is printed when \fBsudo\fR is run by root with the +\&\fI\-V\fR option. +.Ip "env_keep" 12 +.IX Item "env_keep" +A double-quoted, space-separated list of environment variables to +be preserved in the user's environment when the \fIenv_reset\fR option +is in effect. This allows fine-grained control over the environment +\&\fBsudo\fR\-spawned processes will get. The list can be replaced, added +to, deleted from, or disabled by using the \f(CW\*(C`=\*(C'\fR, \f(CW\*(C`+=\*(C'\fR, \f(CW\*(C`\-=\*(C'\fR, and + operators respectively. This list has no default members. +.PP When logging via \fIsyslog\fR\|(3), \fBsudo\fR accepts the following values for the syslog facility (the value of the \fBsyslog\fR Parameter): \fBauthpriv\fR (if your \s-1OS\s0 supports it), \fBauth\fR, \fBdaemon\fR, \fBuser\fR, \fBlocal0\fR, \fBlocal1\fR, \fBlocal2\fR, @@ -672,7 +704,7 @@ syslog priorities are supported: \fBalert\fR, \fBcrit\fR, \fBdebug\fR, \fBemerg\ .Sh "User Specification" .IX Subsection "User Specification" .Vb 2 -\& User_Spec ::= User_list Host_List '=' User_List Cmnd_Spec_List \e +\& User_Spec ::= User_list Host_List '=' Cmnd_Spec_List \e \& (':' User_Spec)* .Ve .Vb 2 @@ -687,7 +719,7 @@ syslog priorities are supported: \fBalert\fR, \fBcrit\fR, \fBdebug\fR, \fBemerg\ .Ve A \fBuser specification\fR determines which commands a user may run (and as what user) on specified hosts. By default, commands are -run as \fBroot\fR but this can be changed on a per-command basis. +run as \fBroot\fR, but this can be changed on a per-command basis. .PP Let's break that down into its constituent parts: .Sh "Runas_Spec" @@ -702,7 +734,7 @@ commands that follow it. What this means is that for the entry: \& dgb boulder = (operator) /bin/ls, /bin/kill, /usr/bin/who .Ve 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. Eg. +\&\fI/usr/bin/lprm\fR \*(-- but only as \fBoperator\fR. E.g., .PP .Vb 1 \& sudo -u operator /bin/ls. @@ -735,7 +767,7 @@ run \fI/bin/kill\fR without a password the entry would be: .Vb 1 \& ray rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm .Ve -Note however, that the \f(CW\*(C`PASSWD\*(C'\fR tag has no effect on users who are +Note, however, that the \f(CW\*(C`PASSWD\*(C'\fR tag has no effect on users who are in the group specified by the exempt_group option. .PP By default, if the \f(CW\*(C`NOPASSWD\*(C'\fR tag is applied to any of the entries @@ -779,8 +811,8 @@ match \f(CW\*(C`/usr/bin/who\*(C'\fR but not \f(CW\*(C`/usr/bin/X11/xterm\*(C'\f .Sh "Exceptions to wildcard rules:" .IX Subsection "Exceptions to wildcard rules:" The following exceptions apply to the above rules: -.if n .Ip "\f(CW\*(C`""""""""\*(C'\fR" 8 -.el .Ip "\f(CW\*(C```''\*(C'\fR" 8 +.if n .Ip "\f(CW""""""""\fR" 8 +.el .Ip "\f(CW``''\fR" 8 .IX Item """"" If the empty string \f(CW\*(C`""\*(C'\fR is the only command line argument in the \&\fIsudoers\fR entry it means that command is not allowed to be run @@ -811,11 +843,11 @@ run \*(L"all but a few\*(R" commands rarely works as intended (see \s-1SECURITY\ Long lines can be continued with a backslash ('\e') as the last character on the line. .PP -Whitespace between elements in a list as well as specicial syntactic +Whitespace between elements in a list as well as special syntactic characters in a \fIUser Specification\fR ('=', ':', '(', ')') is optional. .PP The following characters must be escaped with a backslash ('\e') when -used as part of a word (eg. a username or hostname): +used as part of a word (e.g. a username or hostname): \&'@', '!', '=', ':', ',', '(', ')', '\e'. .SH "EXAMPLES" .IX Header "EXAMPLES" @@ -901,7 +933,7 @@ command on any host but they must authenticate themselves first .Ve The user \fBjack\fR may run any command on the machines in the \fI\s-1CSNETS\s0\fR alias (the networks \f(CW\*(C`128.138.243.0\*(C'\fR, \f(CW\*(C`128.138.204.0\*(C'\fR, and \f(CW\*(C`128.138.242.0\*(C'\fR). -Of those networks, only <128.138.204.0> has an explicit netmask (in +Of those networks, only \f(CW\*(C`128.138.204.0\*(C'\fR has an explicit netmask (in \&\s-1CIDR\s0 notation) indicating it is a class C network. For the other networks in \fI\s-1CSNETS\s0\fR, the local machine's netmask will be used during matching. @@ -1002,7 +1034,7 @@ web pages) or simply \fIsu\fR\|(1) to www. .Ve Any user may mount or unmount a \s-1CD-ROM\s0 on the machines in the \s-1CDROM\s0 \&\f(CW\*(C`Host_Alias\*(C'\fR (orion, perseus, hercules) without entering a password. -This is a bit tedious for users to type, so it is a prime candiate +This is a bit tedious for users to type, so it is a prime candidate for encapsulating in a shell script. .SH "SECURITY NOTES" .IX Header "SECURITY NOTES" diff --git a/visudo.cat b/visudo.cat index eeb237275..3402aa1b5 100644 --- a/visudo.cat +++ b/visudo.cat @@ -8,7 +8,7 @@ NNNNAAAAMMMMEEEE visudo - edit the sudoers file SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS - vvvviiiissssuuuuddddoooo [ ----ssss ] [ ----VVVV ] + vvvviiiissssuuuuddddoooo [ ----cccc ] [ ----ffff _s_u_d_o_e_r_s ] [ ----qqqq ] [ ----ssss ] [ ----VVVV ] DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN vvvviiiissssuuuuddddoooo edits the _s_u_d_o_e_r_s file in a safe fashion, analogous @@ -20,17 +20,16 @@ DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN There is a hard-coded list of editors that vvvviiiissssuuuuddddoooo will use set at compile-time that may be overridden via the _e_d_i_t_o_r - _s_u_d_o_e_r_s `Default' variable. This list defaults to the - path to _v_i(1) on your system, as determined by the _c_o_n_f_i_g_­ - _u_r_e script. Normally, vvvviiiissssuuuuddddoooo does not honor the `EDITOR' - or `VISUAL' environment variables unless they contain an - editor in the aforementioned editors list. However, if - vvvviiiissssuuuuddddoooo is configured with the _-_-_w_i_t_h_-_e_n_v_e_d_i_t_o_r flag or the - _e_n_v_e_d_i_t_o_r `Default' variable is set in _s_u_d_o_e_r_s, vvvviiiissssuuuuddddoooo - will use any the editor defines by `EDITOR' or `VISUAL'. - Note that this can be a security hole since it allows the - user to execute any program they wish simply by setting - `EDITOR' or `VISUAL'. + _s_u_d_o_e_r_s Default variable. This list defaults to the path + to _v_i(1) on your system, as determined by the _c_o_n_f_i_g_u_r_e + script. Normally, vvvviiiissssuuuuddddoooo does not honor the EDITOR or + VISUAL environment variables unless they contain an editor + in the aforementioned editors list. However, if vvvviiiissssuuuuddddoooo is + configured with the _-_-_w_i_t_h_-_e_n_v_e_d_i_t_o_r flag or the _e_n_v_e_d_i_t_o_r + Default variable is set in _s_u_d_o_e_r_s, vvvviiiissssuuuuddddoooo will use any + the editor defines by EDITOR or VISUAL. Note that this + can be a security hole since it allows the user to execute + any program they wish simply by setting EDITOR or VISUAL. vvvviiiissssuuuuddddoooo parses the _s_u_d_o_e_r_s file after the edit and will not save the changes if there is a syntax error. Upon finding @@ -50,18 +49,19 @@ DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN OOOOPPPPTTTTIIIIOOOONNNNSSSS vvvviiiissssuuuuddddoooo accepts the following command line options: - -s Enable ssssttttrrrriiiicccctttt checking of the _s_u_d_o_e_r_s file. If an - alias is used before it is defined, vvvviiiissssuuuuddddoooo will con­ - sider this a parse error. Note that it is not possi­ - ble to differentiate between an alias and a hostname - or username that consists solely of upper case let­ - ters, digits, and the underscore ('_') character. + -c Enable cccchhhheeeecccckkkk----oooonnnnllllyyyy mode. The existing _s_u_d_o_e_r_s file + will be checked for syntax and a message will be + printed to the standard output detailing the status of + _s_u_d_o_e_r_s. If the syntax check completes successfully, + vvvviiiissssuuuuddddoooo will exit with a value of 0. If a syntax error + is encountered, vvvviiiissssuuuuddddoooo will exit with a value of 1. + -f Specify and alternate _s_u_d_o_e_r_s file location. With + this option vvvviiiissssuuuuddddoooo will edit (or check) the _s_u_d_o_e_r_s - -December 29, 2000 1.6.4 1 +December 12, 2001 1.6.4 1 @@ -70,6 +70,21 @@ December 29, 2000 1.6.4 1 visudo(1m) MAINTENANCE COMMANDS visudo(1m) + file of your choice, instead of the default, + @sysconfdir@/sudoers. The lock file used is the spec­ + ified _s_u_d_o_e_r_s file with ".tmp" appended to it. + + -q Enable qqqquuuuiiiieeeetttt mode. In this mode details about syntax + errors are not printed. This option is only useful + when combined with the ----cccc flag. + + -s Enable ssssttttrrrriiiicccctttt checking of the _s_u_d_o_e_r_s file. If an + alias is used before it is defined, vvvviiiissssuuuuddddoooo will con­ + sider this a parse error. Note that it is not possi­ + ble to differentiate between an alias and a hostname + or username that consists solely of uppercase letters, + digits, and the underscore ('_') character. + -V The ----VVVV (version) option causes vvvviiiissssuuuuddddoooo to print its version number and exit. @@ -86,10 +101,10 @@ EEEERRRRRRRROOOORRRRSSSS Warning: undeclared Alias referenced near ... Either you are using a {User,Runas,Host,Cmnd}_Alias before defining it or you have a user or hostname - listed that consists solely of upper case letters, - digits, and the underscore ('_') character. If the - latter, you can ignore the warnings (ssssuuuuddddoooo will not - complain). In ----ssss (strict) mode these are errors, not + listed that consists solely of uppercase letters, dig­ + its, and the underscore ('_') character. If the lat­ + ter, you can ignore the warnings (ssssuuuuddddoooo will not com­ + plain). In ----ssss (strict) mode these are errors, not warnings. EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT @@ -109,6 +124,18 @@ AAAAUUUUTTTTHHHHOOOORRRR Many people have worked on _s_u_d_o over the years; this ver­ sion of vvvviiiissssuuuuddddoooo was written by: + + + +December 12, 2001 1.6.4 2 + + + + + +visudo(1m) MAINTENANCE COMMANDS visudo(1m) + + Todd Miller See the HISTORY file in the sudo distribution or visit @@ -124,18 +151,6 @@ DDDDIIIISSSSCCCCLLLLAAAAIIIIMMMMEEEERRRR warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. See the LICENSE file distributed - - - -December 29, 2000 1.6.4 2 - - - - - -visudo(1m) MAINTENANCE COMMANDS visudo(1m) - - with ssssuuuuddddoooo for complete details. CCCCAAAAVVVVEEEEAAAATTTTSSSS @@ -178,21 +193,6 @@ SSSSEEEEEEEE AAAALLLLSSSSOOOO - - - - - - - - - - - - - - - -December 29, 2000 1.6.4 3 +December 12, 2001 1.6.4 3 diff --git a/visudo.man.in b/visudo.man.in index b999fdb46..600ee2658 100644 --- a/visudo.man.in +++ b/visudo.man.in @@ -1,5 +1,5 @@ -.\" Automatically generated by Pod::Man version 1.04 -.\" Fri Dec 29 20:16:41 2000 +.\" Automatically generated by Pod::Man version 1.15 +.\" Wed Dec 12 13:27:24 2001 .\" .\" Standard preamble: .\" ====================================================================== @@ -46,8 +46,8 @@ . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" -. ds C` ` -. ds C' ' +. ds C` +. ds C' 'br\} .el\{\ . ds -- \|\(em\| @@ -63,7 +63,7 @@ .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" -. . +.. . nr % 0 . rr F .\} @@ -138,13 +138,13 @@ .\" ====================================================================== .\" .IX Title "visudo @mansectsu@" -.TH visudo @mansectsu@ "1.6.4" "December 29, 2000" "MAINTENANCE COMMANDS" +.TH visudo @mansectsu@ "1.6.4" "December 12, 2001" "MAINTENANCE COMMANDS" .UC .SH "NAME" visudo \- edit the sudoers file .SH "SYNOPSIS" .IX Header "SYNOPSIS" -\&\fBvisudo\fR [ \fB\-s\fR ] [ \fB\-V\fR ] +\&\fBvisudo\fR [ \fB\-c\fR ] [ \fB\-f\fR \fIsudoers\fR ] [ \fB\-q\fR ] [ \fB\-s\fR ] [ \fB\-V\fR ] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBvisudo\fR edits the \fIsudoers\fR file in a safe fashion, analogous to @@ -181,12 +181,31 @@ error occurred (if the editor supports this feature). .SH "OPTIONS" .IX Header "OPTIONS" \&\fBvisudo\fR accepts the following command line options: +.Ip "\-c" 4 +.IX Item "-c" +Enable \fBcheck-only\fR mode. The existing \fIsudoers\fR file will be +checked for syntax and a message will be printed to the +standard output detailing the status of \fIsudoers\fR. +If the syntax check completes successfully, \fBvisudo\fR will +exit with a value of 0. If a syntax error is encountered, +\&\fBvisudo\fR will exit with a value of 1. +.Ip "\-f" 4 +.IX Item "-f" +Specify and alternate \fIsudoers\fR file location. With this option +\&\fBvisudo\fR will edit (or check) the \fIsudoers\fR file of your choice, +instead of the default, \f(CW@sysconfdir\fR@/sudoers. The lock file used +is the specified \fIsudoers\fR file with \*(L".tmp\*(R" appended to it. +.Ip "\-q" 4 +.IX Item "-q" +Enable \fBquiet\fR mode. In this mode details about syntax errors +are not printed. This option is only useful when combined with +the \fB\-c\fR flag. .Ip "\-s" 4 .IX Item "-s" Enable \fBstrict\fR checking of the \fIsudoers\fR file. If an alias is used before it is defined, \fBvisudo\fR will consider this a parse error. Note that it is not possible to differentiate between an -alias and a hostname or username that consists solely of upper case +alias and a hostname or username that consists solely of uppercase letters, digits, and the underscore ('_') character. .Ip "\-V" 4 .IX Item "-V" @@ -207,7 +226,7 @@ Your userid does not appear in the system passwd file. .IX Item "Warning: undeclared Alias referenced near ..." Either you are using a {User,Runas,Host,Cmnd}_Alias before defining it or you have a user or hostname listed that -consists solely of upper case letters, digits, and the +consists solely of uppercase letters, digits, and the underscore ('_') character. If the latter, you can ignore the warnings (\fBsudo\fR will not complain). In \fB\-s\fR (strict) mode these are errors, not warnings. -- 2.40.0