Annotation of embedaddon/sudo/doc/sudo.cat, revision 1.1.1.4
1.1.1.3 misho 1: SUDO(1m) System Manager's Manual SUDO(1m)
1.1 misho 2:
3: NNAAMMEE
1.1.1.3 misho 4: ssuuddoo, ssuuddooeeddiitt - execute a command as another user
1.1 misho 5:
6: SSYYNNOOPPSSIISS
1.1.1.3 misho 7: ssuuddoo --hh | --KK | --kk | --VV
8: ssuuddoo --vv [--AAkknnSS] [--aa _a_u_t_h___t_y_p_e] [--gg _g_r_o_u_p _n_a_m_e | _#_g_i_d] [--pp _p_r_o_m_p_t]
9: [--uu _u_s_e_r _n_a_m_e | _#_u_i_d]
10: ssuuddoo --ll[_l] [--AAkknnSS] [--aa _a_u_t_h___t_y_p_e] [--gg _g_r_o_u_p _n_a_m_e | _#_g_i_d] [--pp _p_r_o_m_p_t]
11: [--UU _u_s_e_r _n_a_m_e] [--uu _u_s_e_r _n_a_m_e | _#_u_i_d] [_c_o_m_m_a_n_d]
12: ssuuddoo [--AAbbEEHHnnPPSS] [--aa _a_u_t_h___t_y_p_e] [--CC _f_d] [--cc _c_l_a_s_s | _-]
13: [--gg _g_r_o_u_p _n_a_m_e | _#_g_i_d] [--pp _p_r_o_m_p_t] [--rr _r_o_l_e] [--tt _t_y_p_e]
14: [--uu _u_s_e_r _n_a_m_e | _#_u_i_d] [VVAARR=_v_a_l_u_e] --ii | --ss [_c_o_m_m_a_n_d]
15: ssuuddooeeddiitt [--AAnnSS] [--aa _a_u_t_h___t_y_p_e] [--CC _f_d] [--cc _c_l_a_s_s | _-]
16: [--gg _g_r_o_u_p _n_a_m_e | _#_g_i_d] [--pp _p_r_o_m_p_t] [--uu _u_s_e_r _n_a_m_e | _#_u_i_d] file
17: ...
1.1 misho 18:
19: DDEESSCCRRIIPPTTIIOONN
1.1.1.3 misho 20: ssuuddoo allows a permitted user to execute a _c_o_m_m_a_n_d as the superuser or
21: another user, as specified by the security policy.
22:
23: ssuuddoo supports a plugin architecture for security policies and
24: input/output logging. Third parties can develop and distribute their own
25: policy and I/O logging plugins to work seamlessly with the ssuuddoo front
26: end. The default security policy is _s_u_d_o_e_r_s, which is configured via the
1.1.1.4 ! misho 27: file _/_e_t_c_/_s_u_d_o_e_r_s, or via LDAP. See the _P_l_u_g_i_n_s section for more
1.1.1.3 misho 28: information.
29:
30: The security policy determines what privileges, if any, a user has to run
31: ssuuddoo. The policy may require that users authenticate themselves with a
32: password or another authentication mechanism. If authentication is
33: required, ssuuddoo will exit if the user's password is not entered within a
34: configurable time limit. This limit is policy-specific; the default
35: password prompt timeout for the _s_u_d_o_e_r_s security policy is 5 minutes.
36:
37: Security policies may support credential caching to allow the user to run
38: ssuuddoo again for a period of time without requiring authentication. The
39: _s_u_d_o_e_r_s policy caches credentials for 5 minutes, unless overridden in
40: sudoers(4). By running ssuuddoo with the --vv option, a user can update the
41: cached credentials without running a _c_o_m_m_a_n_d.
42:
43: When invoked as ssuuddooeeddiitt, the --ee option (described below), is implied.
44:
45: Security policies may log successful and failed attempts to use ssuuddoo. If
46: an I/O plugin is configured, the running command's input and output may
47: be logged as well.
48:
49: The options are as follows:
50:
51: --AA Normally, if ssuuddoo requires a password, it will read it from
52: the user's terminal. If the --AA (_a_s_k_p_a_s_s) option is
53: specified, a (possibly graphical) helper program is executed
54: to read the user's password and output the password to the
55: standard output. If the SUDO_ASKPASS environment variable is
56: set, it specifies the path to the helper program. Otherwise,
1.1.1.4 ! misho 57: if sudo.conf(4) contains a line specifying the askpass
1.1.1.3 misho 58: program, that value will be used. For example:
59:
60: # Path to askpass helper program
61: Path askpass /usr/X11R6/bin/ssh-askpass
62:
63: If no askpass program is available, ssuuddoo will exit with an
64: error.
65:
66: --aa _t_y_p_e The --aa (_a_u_t_h_e_n_t_i_c_a_t_i_o_n _t_y_p_e) option causes ssuuddoo to use the
67: specified authentication type when validating the user, as
68: allowed by _/_e_t_c_/_l_o_g_i_n_._c_o_n_f. The system administrator may
69: specify a list of sudo-specific authentication methods by
70: adding an ``auth-sudo'' entry in _/_e_t_c_/_l_o_g_i_n_._c_o_n_f. This
71: option is only available on systems that support BSD
72: authentication.
73:
74: --bb The --bb (_b_a_c_k_g_r_o_u_n_d) option tells ssuuddoo to run the given
75: command in the background. Note that if you use the --bb
76: option you cannot use shell job control to manipulate the
77: process. Most interactive commands will fail to work
78: properly in background mode.
79:
80: --CC _f_d Normally, ssuuddoo will close all open file descriptors other
81: than standard input, standard output and standard error. The
82: --CC (_c_l_o_s_e _f_r_o_m) option allows the user to specify a starting
83: point above the standard error (file descriptor three).
84: Values less than three are not permitted. The security
85: policy may restrict the user's ability to use the --CC option.
86: The _s_u_d_o_e_r_s policy only permits use of the --CC option when the
87: administrator has enabled the _c_l_o_s_e_f_r_o_m___o_v_e_r_r_i_d_e option.
88:
89: --cc _c_l_a_s_s The --cc (_c_l_a_s_s) option causes ssuuddoo to run the specified
90: command with resources limited by the specified login class.
91: The _c_l_a_s_s argument can be either a class name as defined in
92: _/_e_t_c_/_l_o_g_i_n_._c_o_n_f, or a single `-' character. Specifying a
93: _c_l_a_s_s of - indicates that the command should be run
94: restricted by the default login capabilities for the user the
95: command is run as. If the _c_l_a_s_s argument specifies an
96: existing user class, the command must be run as root, or the
97: ssuuddoo command must be run from a shell that is already root.
98: This option is only available on systems with BSD login
99: classes.
100:
101: --EE The --EE (_p_r_e_s_e_r_v_e _e_n_v_i_r_o_n_m_e_n_t) option indicates to the
102: security policy that the user wishes to preserve their
103: existing environment variables. The security policy may
104: return an error if the --EE option is specified and the user
105: does not have permission to preserve the environment.
106:
107: --ee The --ee (_e_d_i_t) option indicates that, instead of running a
108: command, the user wishes to edit one or more files. In lieu
109: of a command, the string "sudoedit" is used when consulting
110: the security policy. If the user is authorized by the
111: policy, the following steps are taken:
1.1 misho 112:
1.1.1.3 misho 113: 1. Temporary copies are made of the files to be edited
1.1 misho 114: with the owner set to the invoking user.
115:
1.1.1.3 misho 116: 2. The editor specified by the policy is run to edit the
1.1 misho 117: temporary files. The _s_u_d_o_e_r_s policy uses the
118: SUDO_EDITOR, VISUAL and EDITOR environment variables
119: (in that order). If none of SUDO_EDITOR, VISUAL or
120: EDITOR are set, the first program listed in the _e_d_i_t_o_r
1.1.1.3 misho 121: sudoers(4) option is used.
1.1 misho 122:
1.1.1.3 misho 123: 3. If they have been modified, the temporary files are
1.1 misho 124: copied back to their original location and the
125: temporary versions are removed.
126:
1.1.1.3 misho 127: If the specified file does not exist, it will be created.
128: Note that unlike most commands run by _s_u_d_o, the editor is run
129: with the invoking user's environment unmodified. If, for
130: some reason, ssuuddoo is unable to update a file with its edited
131: version, the user will receive a warning and the edited copy
132: will remain in a temporary file.
133:
134: --gg _g_r_o_u_p Normally, ssuuddoo runs a command with the primary group set to
135: the one specified by the password database for the user the
136: command is being run as (by default, root). The --gg (_g_r_o_u_p)
137: option causes ssuuddoo to run the command with the primary group
138: set to _g_r_o_u_p instead. To specify a _g_i_d instead of a _g_r_o_u_p
139: _n_a_m_e, use _#_g_i_d. When running commands as a _g_i_d, many shells
140: require that the `#' be escaped with a backslash (`\'). If
141: no --uu option is specified, the command will be run as the
142: invoking user (not root). In either case, the primary group
143: will be set to _g_r_o_u_p.
144:
145: --HH The --HH (_H_O_M_E) option requests that the security policy set
146: the HOME environment variable to the home directory of the
147: target user (root by default) as specified by the password
148: database. Depending on the policy, this may be the default
149: behavior.
150:
151: --hh The --hh (_h_e_l_p) option causes ssuuddoo to print a short help
152: message to the standard output and exit.
153:
154: --ii [_c_o_m_m_a_n_d]
155: The --ii (_s_i_m_u_l_a_t_e _i_n_i_t_i_a_l _l_o_g_i_n) option runs the shell
156: specified by the password database entry of the target user
157: as a login shell. This means that login-specific resource
158: files such as _._p_r_o_f_i_l_e or _._l_o_g_i_n will be read by the shell.
159: If a command is specified, it is passed to the shell for
160: execution via the shell's --cc option. If no command is
161: specified, an interactive shell is executed. ssuuddoo attempts
162: to change to that user's home directory before running the
163: shell. The security policy shall initialize the environment
164: to a minimal set of variables, similar to what is present
165: when a user logs in. The _C_o_m_m_a_n_d _E_n_v_i_r_o_n_m_e_n_t section in the
166: sudoers(4) manual documents how the --ii option affects the
167: environment in which a command is run when the _s_u_d_o_e_r_s policy
168: is in use.
169:
170: --KK The --KK (sure _k_i_l_l) option is like --kk except that it removes
171: the user's cached credentials entirely and may not be used in
172: conjunction with a command or other option. This option does
173: not require a password. Not all security policies support
174: credential caching.
175:
176: --kk [_c_o_m_m_a_n_d]
177: When used alone, the --kk (_k_i_l_l) option to ssuuddoo invalidates the
178: user's cached credentials. The next time ssuuddoo is run a
179: password will be required. This option does not require a
180: password and was added to allow a user to revoke ssuuddoo
181: permissions from a _._l_o_g_o_u_t file. Not all security policies
182: support credential caching.
183:
184: When used in conjunction with a command or an option that may
185: require a password, the --kk option will cause ssuuddoo to ignore
186: the user's cached credentials. As a result, ssuuddoo will prompt
187: for a password (if one is required by the security policy)
188: and will not update the user's cached credentials.
189:
190: --ll[ll] [_c_o_m_m_a_n_d]
191: If no _c_o_m_m_a_n_d is specified, the --ll (_l_i_s_t) option will list
192: the allowed (and forbidden) commands for the invoking user
193: (or the user specified by the --UU option) on the current host.
194: If a _c_o_m_m_a_n_d is specified and is permitted by the security
195: policy, the fully-qualified path to the command is displayed
196: along with any command line arguments. If _c_o_m_m_a_n_d is
197: specified but not allowed, ssuuddoo will exit with a status value
198: of 1. If the --ll option is specified with an _l argument (i.e.
199: --llll), or if --ll is specified multiple times, a longer list
200: format is used.
201:
202: --nn The --nn (_n_o_n_-_i_n_t_e_r_a_c_t_i_v_e) option prevents ssuuddoo from prompting
203: the user for a password. If a password is required for the
204: command to run, ssuuddoo will display an error message and exit.
205:
206: --PP The --PP (_p_r_e_s_e_r_v_e _g_r_o_u_p _v_e_c_t_o_r) option causes ssuuddoo to preserve
207: the invoking user's group vector unaltered. By default, the
208: _s_u_d_o_e_r_s policy will initialize the group vector to the list
209: of groups the target user is in. The real and effective
210: group IDs, however, are still set to match the target user.
211:
212: --pp _p_r_o_m_p_t The --pp (_p_r_o_m_p_t) option allows you to override the default
213: password prompt and use a custom one. The following percent
214: (`%') escapes are supported by the _s_u_d_o_e_r_s policy:
215:
216: %H expanded to the host name including the domain name (on
217: if the machine's host name is fully qualified or the _f_q_d_n
218: option is set in sudoers(4))
219:
220: %h expanded to the local host name without the domain name
221:
222: %p expanded to the name of the user whose password is being
223: requested (respects the _r_o_o_t_p_w, _t_a_r_g_e_t_p_w, and _r_u_n_a_s_p_w
224: flags in sudoers(4))
225:
226: %U expanded to the login name of the user the command will
227: be run as (defaults to root unless the --uu option is also
228: specified)
229:
230: %u expanded to the invoking user's login name
231:
232: %% two consecutive `%' characters are collapsed into a
233: single `%' character
234:
235: The prompt specified by the --pp option will override the
236: system password prompt on systems that support PAM unless the
237: _p_a_s_s_p_r_o_m_p_t___o_v_e_r_r_i_d_e flag is disabled in _s_u_d_o_e_r_s.
238:
239: --rr _r_o_l_e The --rr (_r_o_l_e) option causes the new (SELinux) security
240: context to have the role specified by _r_o_l_e.
241:
242: --SS The --SS (_s_t_d_i_n) option causes ssuuddoo to read the password from
243: the standard input instead of the terminal device. The
244: password must be followed by a newline character.
245:
246: --ss [_c_o_m_m_a_n_d]
247: The --ss (_s_h_e_l_l) option runs the shell specified by the SHELL
248: environment variable if it is set or the shell as specified
249: in the password database. If a command is specified, it is
250: passed to the shell for execution via the shell's --cc option.
251: If no command is specified, an interactive shell is executed.
252:
253: --tt _t_y_p_e The --tt (_t_y_p_e) option causes the new (SELinux) security
254: context to have the type specified by _t_y_p_e. If no type is
255: specified, the default type is derived from the specified
256: role.
257:
258: --UU _u_s_e_r The --UU (_o_t_h_e_r _u_s_e_r) option is used in conjunction with the --ll
259: option to specify the user whose privileges should be listed.
260: The security policy may restrict listing other users'
261: privileges. The _s_u_d_o_e_r_s policy only allows root or a user
262: with the ALL privilege on the current host to use this
263: option.
264:
265: --uu _u_s_e_r The --uu (_u_s_e_r) option causes ssuuddoo to run the specified command
266: as a user other than _r_o_o_t. To specify a _u_i_d instead of a
267: _u_s_e_r _n_a_m_e, _#_u_i_d. When running commands as a _u_i_d, many shells
268: require that the `#' be escaped with a backslash (`\').
269: Security policies may restrict _u_i_ds to those listed in the
270: password database. The _s_u_d_o_e_r_s policy allows _u_i_ds that are
271: not in the password database as long as the _t_a_r_g_e_t_p_w option
272: is not set. Other security policies may not support this.
273:
274: --VV The --VV (_v_e_r_s_i_o_n) option causes ssuuddoo to print its version
275: string and the version string of the security policy plugin
276: and any I/O plugins. If the invoking user is already root
277: the --VV option will display the arguments passed to configure
278: when ssuuddoo was built and plugins may display more verbose
279: information such as default options.
280:
281: --vv When given the --vv (_v_a_l_i_d_a_t_e) option, ssuuddoo will update the
282: user's cached credentials, authenticating the user's password
283: if necessary. For the _s_u_d_o_e_r_s plugin, this extends the ssuuddoo
284: timeout for another 5 minutes (or whatever the timeout is set
285: to by the security policy) but does not run a command. Not
286: all security policies support cached credentials.
287:
288: ---- The ---- option indicates that ssuuddoo should stop processing
289: command line arguments.
290:
291: Environment variables to be set for the command may also be passed on the
292: command line in the form of VVAARR=_v_a_l_u_e, e.g.
293: LLDD__LLIIBBRRAARRYY__PPAATTHH=_/_u_s_r_/_l_o_c_a_l_/_p_k_g_/_l_i_b. Variables passed on the command line
294: are subject to the same restrictions as normal environment variables with
295: one important exception. If the _s_e_t_e_n_v option is set in _s_u_d_o_e_r_s, the
296: command to be run has the SETENV tag set or the command matched is ALL,
297: the user may set variables that would otherwise be forbidden. See
298: sudoers(4) for more information.
299:
300: CCOOMMMMAANNDD EEXXEECCUUTTIIOONN
301: When ssuuddoo executes a command, the security policy specifies the execution
1.1.1.4 ! misho 302: environment for the command. Typically, the real and effective uid and
1.1.1.3 misho 303: gid are set to match those of the target user, as specified in the
304: password database, and the group vector is initialized based on the group
305: database (unless the --PP option was specified).
306:
307: The following parameters may be specified by security policy:
308:
309: oo real and effective user ID
310:
311: oo real and effective group ID
312:
313: oo supplementary group IDs
314:
315: oo the environment list
316:
317: oo current working directory
318:
319: oo file creation mode mask (umask)
320:
321: oo SELinux role and type
322:
323: oo Solaris project
324:
325: oo Solaris privileges
326:
327: oo BSD login class
328:
329: oo scheduling priority (aka nice value)
330:
331: PPrroocceessss mmooddeell
332: When ssuuddoo runs a command, it calls fork(2), sets up the execution
333: environment as described above, and calls the execve system call in the
334: child process. The main ssuuddoo process waits until the command has
335: completed, then passes the command's exit status to the security policy's
1.1.1.4 ! misho 336: close function and exits. If an I/O logging plugin is configured or if
! 337: the security policy explicitly requests it, a new pseudo-terminal
! 338: (``pty'') is created and a second ssuuddoo process is used to relay job
! 339: control signals between the user's existing pty and the new pty the
! 340: command is being run in. This extra process makes it possible to, for
! 341: example, suspend and resume the command. Without it, the command would
! 342: be in what POSIX terms an ``orphaned process group'' and it would not
! 343: receive any job control signals. As a special case, if the policy plugin
! 344: does not define a close function and no pty is required, ssuuddoo will
! 345: execute the command directly instead of calling fork(2) first.
1.1.1.3 misho 346:
347: SSiiggnnaall hhaannddlliinngg
348: Because the command is run as a child of the ssuuddoo process, ssuuddoo will
349: relay signals it receives to the command. Unless the command is being
350: run in a new pty, the SIGHUP, SIGINT and SIGQUIT signals are not relayed
351: unless they are sent by a user process, not the kernel. Otherwise, the
352: command would receive SIGINT twice every time the user entered control-C.
353: Some signals, such as SIGSTOP and SIGKILL, cannot be caught and thus will
354: not be relayed to the command. As a general rule, SIGTSTP should be used
355: instead of SIGSTOP when you wish to suspend a command being run by ssuuddoo.
356:
357: As a special case, ssuuddoo will not relay signals that were sent by the
358: command it is running. This prevents the command from accidentally
359: killing itself. On some systems, the reboot(1m) command sends SIGTERM to
1.1.1.4 ! misho 360: all non-system processes other than itself before rebooting the system.
1.1.1.3 misho 361: This prevents ssuuddoo from relaying the SIGTERM signal it received back to
362: reboot(1m), which might then exit before the system was actually rebooted,
363: leaving it in a half-dead state similar to single user mode. Note,
364: however, that this check only applies to the command run by ssuuddoo and not
365: any other processes that the command may create. As a result, running a
366: script that calls reboot(1m) or shutdown(1m) via ssuuddoo may cause the system
367: to end up in this undefined state unless the reboot(1m) or shutdown(1m) are
368: run using the eexxeecc() family of functions instead of ssyysstteemm() (which
369: interposes a shell between the command and the calling process).
1.1 misho 370:
1.1.1.4 ! misho 371: If no I/O logging plugins are loaded and the policy plugin has not
! 372: defined a cclloossee() function, set a command timeout or required that the
! 373: command be run in a new pty, ssuuddoo may execute the command directly
! 374: instead of running it as a child process.
! 375:
! 376: PPlluuggiinnss
! 377: Plugins are dynamically loaded based on the contents of the sudo.conf(4)
! 378: file. If no sudo.conf(4) file is present, or it contains no Plugin
! 379: lines, ssuuddoo will use the traditional _s_u_d_o_e_r_s security policy and I/O
! 380: logging. See the sudo.conf(4) manual for details of the _/_e_t_c_/_s_u_d_o_._c_o_n_f
! 381: file and the sudo_plugin(1m) manual for more information about the ssuuddoo
! 382: plugin architecture.
1.1.1.2 misho 383:
1.1.1.3 misho 384: EEXXIITT VVAALLUUEE
385: Upon successful execution of a program, the exit status from _s_u_d_o will
386: simply be the exit status of the program that was executed.
1.1 misho 387:
1.1.1.3 misho 388: Otherwise, ssuuddoo exits with a value of 1 if there is a
389: configuration/permission problem or if ssuuddoo cannot execute the given
390: command. In the latter case the error string is printed to the standard
391: error. If ssuuddoo cannot stat(2) one or more entries in the user's PATH, an
392: error is printed on stderr. (If the directory does not exist or if it is
393: not really a directory, the entry is ignored and no error is printed.)
394: This should not happen under normal circumstances. The most common
395: reason for stat(2) to return ``permission denied'' is if you are running
396: an automounter and one of the directories in your PATH is on a machine
397: that is currently unreachable.
1.1 misho 398:
399: SSEECCUURRIITTYY NNOOTTEESS
1.1.1.3 misho 400: ssuuddoo tries to be safe when executing external commands.
1.1 misho 401:
1.1.1.3 misho 402: To prevent command spoofing, ssuuddoo checks "." and "" (both denoting
403: current directory) last when searching for a command in the user's PATH
404: (if one or both are in the PATH). Note, however, that the actual PATH
405: environment variable is _n_o_t modified and is passed unchanged to the
406: program that ssuuddoo executes.
407:
408: Please note that ssuuddoo will normally only log the command it explicitly
409: runs. If a user runs a command such as sudo su or sudo sh, subsequent
410: commands run from that shell are not subject to ssuuddoo's security policy.
411: The same is true for commands that offer shell escapes (including most
412: editors). If I/O logging is enabled, subsequent commands will have their
413: input and/or output logged, but there will not be traditional logs for
414: those commands. Because of this, care must be taken when giving users
415: access to commands via ssuuddoo to verify that the command does not
416: inadvertently give the user an effective root shell. For more
417: information, please see the _P_R_E_V_E_N_T_I_N_G _S_H_E_L_L _E_S_C_A_P_E_S section in
418: sudoers(4).
419:
420: To prevent the disclosure of potentially sensitive information, ssuuddoo
421: disables core dumps by default while it is executing (they are re-enabled
422: for the command that is run). To aid in debugging ssuuddoo crashes, you may
423: wish to re-enable core dumps by setting ``disable_coredump'' to false in
1.1.1.4 ! misho 424: the sudo.conf(4) file as follows:
1.1.1.3 misho 425:
426: Set disable_coredump false
427:
1.1.1.4 ! misho 428: See the sudo.conf(4) manual for more information.
1.1.1.2 misho 429:
1.1 misho 430: EENNVVIIRROONNMMEENNTT
1.1.1.3 misho 431: ssuuddoo utilizes the following environment variables. The security policy
432: has control over the actual content of the command's environment.
1.1 misho 433:
1.1.1.3 misho 434: EDITOR Default editor to use in --ee (sudoedit) mode if neither
435: SUDO_EDITOR nor VISUAL is set.
1.1 misho 436:
1.1.1.3 misho 437: MAIL In --ii mode or when _e_n_v___r_e_s_e_t is enabled in _s_u_d_o_e_r_s, set
438: to the mail spool of the target user.
1.1 misho 439:
1.1.1.3 misho 440: HOME Set to the home directory of the target user if --ii or --HH
441: are specified, _e_n_v___r_e_s_e_t or _a_l_w_a_y_s___s_e_t___h_o_m_e are set in
442: _s_u_d_o_e_r_s, or when the --ss option is specified and _s_e_t___h_o_m_e
443: is set in _s_u_d_o_e_r_s.
1.1 misho 444:
1.1.1.3 misho 445: PATH May be overridden by the security policy.
1.1 misho 446:
1.1.1.3 misho 447: SHELL Used to determine shell to run with --ss option.
1.1 misho 448:
1.1.1.3 misho 449: SUDO_ASKPASS Specifies the path to a helper program used to read the
450: password if no terminal is available or if the --AA option
451: is specified.
1.1 misho 452:
1.1.1.3 misho 453: SUDO_COMMAND Set to the command run by sudo.
1.1 misho 454:
1.1.1.3 misho 455: SUDO_EDITOR Default editor to use in --ee (sudoedit) mode.
1.1 misho 456:
1.1.1.3 misho 457: SUDO_GID Set to the group ID of the user who invoked sudo.
1.1 misho 458:
1.1.1.3 misho 459: SUDO_PROMPT Used as the default password prompt.
1.1 misho 460:
1.1.1.3 misho 461: SUDO_PS1 If set, PS1 will be set to its value for the program
462: being run.
1.1 misho 463:
1.1.1.3 misho 464: SUDO_UID Set to the user ID of the user who invoked sudo.
1.1 misho 465:
1.1.1.3 misho 466: SUDO_USER Set to the login name of the user who invoked sudo.
1.1 misho 467:
1.1.1.3 misho 468: USER Set to the target user (root unless the --uu option is
469: specified).
1.1 misho 470:
1.1.1.3 misho 471: VISUAL Default editor to use in --ee (sudoedit) mode if
472: SUDO_EDITOR is not set.
1.1 misho 473:
474: FFIILLEESS
1.1.1.3 misho 475: _/_e_t_c_/_s_u_d_o_._c_o_n_f ssuuddoo front end configuration
1.1 misho 476:
477: EEXXAAMMPPLLEESS
1.1.1.3 misho 478: Note: the following examples assume a properly configured security
479: policy.
1.1 misho 480:
1.1.1.3 misho 481: To get a file listing of an unreadable directory:
1.1 misho 482:
1.1.1.3 misho 483: $ sudo ls /usr/local/protected
1.1 misho 484:
1.1.1.3 misho 485: To list the home directory of user yaz on a machine where the file system
486: holding ~yaz is not exported as root:
1.1 misho 487:
1.1.1.3 misho 488: $ sudo -u yaz ls ~yaz
1.1 misho 489:
1.1.1.3 misho 490: To edit the _i_n_d_e_x_._h_t_m_l file as user www:
1.1 misho 491:
1.1.1.3 misho 492: $ sudo -u www vi ~www/htdocs/index.html
1.1 misho 493:
1.1.1.3 misho 494: To view system logs only accessible to root and users in the adm group:
1.1 misho 495:
1.1.1.3 misho 496: $ sudo -g adm view /var/log/syslog
1.1 misho 497:
1.1.1.3 misho 498: To run an editor as jim with a different primary group:
1.1 misho 499:
1.1.1.3 misho 500: $ sudo -u jim -g audio vi ~jim/sound.txt
1.1 misho 501:
1.1.1.3 misho 502: To shut down a machine:
1.1 misho 503:
1.1.1.3 misho 504: $ sudo shutdown -r +15 "quick reboot"
1.1 misho 505:
1.1.1.3 misho 506: To make a usage listing of the directories in the /home partition. Note
507: that this runs the commands in a sub-shell to make the cd and file
508: redirection work.
1.1 misho 509:
1.1.1.3 misho 510: $ sudo sh -c "cd /home ; du -s * | sort -rn > USAGE"
1.1 misho 511:
512: SSEEEE AALLSSOO
1.1.1.4 ! misho 513: su(1), stat(2), login_cap(3), passwd(4), sudo.conf(4), sudoers(4),
1.1.1.3 misho 514: sudo_plugin(1m), sudoreplay(1m), visudo(1m)
1.1 misho 515:
1.1.1.3 misho 516: HHIISSTTOORRYY
517: See the HISTORY file in the ssuuddoo distribution
518: (http://www.sudo.ws/sudo/history.html) for a brief history of sudo.
1.1 misho 519:
1.1.1.3 misho 520: AAUUTTHHOORRSS
521: Many people have worked on ssuuddoo over the years; this version consists of
522: code written primarily by:
1.1 misho 523:
1.1.1.3 misho 524: Todd C. Miller
1.1.1.2 misho 525:
1.1.1.3 misho 526: See the CONTRIBUTORS file in the ssuuddoo distribution
527: (http://www.sudo.ws/sudo/contributors.html) for an exhaustive list of
528: people who have contributed to ssuuddoo.
1.1 misho 529:
530: CCAAVVEEAATTSS
1.1.1.3 misho 531: There is no easy way to prevent a user from gaining a root shell if that
532: user is allowed to run arbitrary commands via ssuuddoo. Also, many programs
533: (such as editors) allow the user to run commands via shell escapes, thus
534: avoiding ssuuddoo's checks. However, on most systems it is possible to
535: prevent shell escapes with the sudoers(4) plugin's _n_o_e_x_e_c functionality.
536:
537: It is not meaningful to run the cd command directly via sudo, e.g.,
538:
539: $ sudo cd /usr/local/protected
540:
541: since when the command exits the parent process (your shell) will still
542: be the same. Please see the _E_X_A_M_P_L_E_S section for more information.
543:
544: Running shell scripts via ssuuddoo can expose the same kernel bugs that make
545: setuid shell scripts unsafe on some operating systems (if your OS has a
546: /dev/fd/ directory, setuid shell scripts are generally safe).
1.1 misho 547:
548: BBUUGGSS
1.1.1.3 misho 549: If you feel you have found a bug in ssuuddoo, please submit a bug report at
550: http://www.sudo.ws/sudo/bugs/
1.1 misho 551:
552: SSUUPPPPOORRTT
1.1.1.3 misho 553: Limited free support is available via the sudo-users mailing list, see
554: http://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search the
555: archives.
1.1 misho 556:
557: DDIISSCCLLAAIIMMEERR
1.1.1.3 misho 558: ssuuddoo is provided ``AS IS'' and any express or implied warranties,
559: including, but not limited to, the implied warranties of merchantability
560: and fitness for a particular purpose are disclaimed. See the LICENSE
561: file distributed with ssuuddoo or http://www.sudo.ws/sudo/license.html for
562: complete details.
1.1 misho 563:
1.1.1.4 ! misho 564: Sudo 1.8.7 March 13, 2013 Sudo 1.8.7
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>