1SUDO(8)                   BSD System Manager's Manual                  SUDO(8)
2

NAME

4     sudo, sudoedit — execute a command as another user
5

SYNOPSIS

7     sudo -h | -K | -k | -V
8     sudo -v [-ABknS] [-g group] [-h host] [-p prompt] [-u user]
9     sudo -l [-ABknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
10          [command]
11     sudo [-ABbEHnPS] [-C num] [-D directory] [-g group] [-h host] [-p prompt]
12          [-R directory] [-r role] [-t type] [-T timeout] [-u user]
13          [VAR=value] [-i | -s] [command]
14     sudoedit [-ABknS] [-C num] [-D directory] [-g group] [-h host]
15          [-p prompt] [-R directory] [-r role] [-t type] [-T timeout]
16          [-u user] file ...
17

DESCRIPTION

19     sudo allows a permitted user to execute a command as the superuser or
20     another user, as specified by the security policy.  The invoking user's
21     real (not effective) user-ID is used to determine the user name with
22     which to query the security policy.
23
24     sudo supports a plugin architecture for security policies and input/out‐
25     put logging.  Third parties can develop and distribute their own policy
26     and I/O logging plugins to work seamlessly with the sudo front end.  The
27     default security policy is sudoers, which is configured via the file
28     /etc/sudoers, or via LDAP.  See the Plugins section for more information.
29
30     The security policy determines what privileges, if any, a user has to run
31     sudo.  The policy may require that users authenticate themselves with a
32     password or another authentication mechanism.  If authentication is
33     required, sudo 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 sudoers security policy is 5 minutes.
36
37     Security policies may support credential caching to allow the user to run
38     sudo again for a period of time without requiring authentication.  By
39     default, the sudoers policy caches credentials on a per-terminal basis
40     for 5 minutes.  See the timestamp_type and timestamp_timeout options in
41     sudoers(5) for more information.  By running sudo with the -v option, a
42     user can update the cached credentials without running a command.
43
44     On systems where sudo is the primary method of gaining superuser privi‐
45     leges, it is imperative to avoid syntax errors in the security policy
46     configuration files.  For the default security policy, sudoers(5),
47     changes to the configuration files should be made using the visudo(8)
48     utility which will ensure that no syntax errors are introduced.
49
50     When invoked as sudoedit, the -e option (described below), is implied.
51
52     Security policies may log successful and failed attempts to use sudo.  If
53     an I/O plugin is configured, the running command's input and output may
54     be logged as well.
55
56     The options are as follows:
57
58     -A, --askpass
59                 Normally, if sudo requires a password, it will read it from
60                 the user's terminal.  If the -A (askpass) option is speci‐
61                 fied, a (possibly graphical) helper program is executed to
62                 read the user's password and output the password to the stan‐
63                 dard output.  If the SUDO_ASKPASS environment variable is
64                 set, it specifies the path to the helper program.  Otherwise,
65                 if sudo.conf(5) contains a line specifying the askpass pro‐
66                 gram, that value will be used.  For example:
67
68                     # Path to askpass helper program
69                     Path askpass /usr/X11R6/bin/ssh-askpass
70
71                 If no askpass program is available, sudo will exit with an
72                 error.
73
74     -B, --bell  Ring the bell as part of the password promp when a terminal
75                 is present.  This option has no effect if an askpass program
76                 is used.
77
78     -b, --background
79                 Run the given command in the background.  Note that it is not
80                 possible to use shell job control to manipulate background
81                 processes started by sudo.  Most interactive commands will
82                 fail to work properly in background mode.
83
84     -C num, --close-from=num
85                 Close all file descriptors greater than or equal to num
86                 before executing a command.  Values less than three are not
87                 permitted.  By default, sudo will close all open file
88                 descriptors other than standard input, standard output and
89                 standard error when executing a command.  The security policy
90                 may restrict the user's ability to use this option.  The
91                 sudoers policy only permits use of the -C option when the
92                 administrator has enabled the closefrom_override option.
93
94     -D directory, --chdir=directory
95                 Run the command in the specified directory instead of the
96                 current working directory.  The security policy may return an
97                 error if the user does not have permission to specify the
98                 working directory.
99
100     -E, --preserve-env
101                 Indicates to the security policy that the user wishes to pre‐
102                 serve their existing environment variables.  The security
103                 policy may return an error if the user does not have permis‐
104                 sion to preserve the environment.
105
106     --preserve-env=list
107                 Indicates to the security policy that the user wishes to add
108                 the comma-separated list of environment variables to those
109                 preserved from the user's environment.  The security policy
110                 may return an error if the user does not have permission to
111                 preserve the environment.  This option may be specified mul‐
112                 tiple times.
113
114     -e, --edit  Edit one or more files instead of running a command.  In lieu
115                 of a path name, the string "sudoedit" is used when consulting
116                 the security policy.  If the user is authorized by the pol‐
117                 icy, the following steps are taken:
118
119                 1.   Temporary copies are made of the files to be edited with
120                      the owner set to the invoking user.
121
122                 2.   The editor specified by the policy is run to edit the
123                      temporary files.  The sudoers policy uses the
124                      SUDO_EDITOR, VISUAL and EDITOR environment variables (in
125                      that order).  If none of SUDO_EDITOR, VISUAL or EDITOR
126                      are set, the first program listed in the editor
127                      sudoers(5) option is used.
128
129                 3.   If they have been modified, the temporary files are
130                      copied back to their original location and the temporary
131                      versions are removed.
132
133                 To help prevent the editing of unauthorized files, the fol‐
134                 lowing restrictions are enforced unless explicitly allowed by
135                 the security policy:
136
137                 ·  Symbolic links may not be edited (version 1.8.15 and
138                    higher).
139
140                 ·  Symbolic links along the path to be edited are not fol‐
141                    lowed when the parent directory is writable by the invok‐
142                    ing user unless that user is root (version 1.8.16 and
143                    higher).
144
145                 ·  Files located in a directory that is writable by the
146                    invoking user may not be edited unless that user is root
147                    (version 1.8.16 and higher).
148
149                 Users are never allowed to edit device special files.
150
151                 If the specified file does not exist, it will be created.
152                 Note that unlike most commands run by sudo, the editor is run
153                 with the invoking user's environment unmodified.  If the tem‐
154                 porary file becomes empty after editing, the user will be
155                 prompted before it is installed.  If, for some reason, sudo
156                 is unable to update a file with its edited version, the user
157                 will receive a warning and the edited copy will remain in a
158                 temporary file.
159
160     -g group, --group=group
161                 Run the command with the primary group set to group instead
162                 of the primary group specified by the target user's password
163                 database entry.  The group may be either a group name or a
164                 numeric group-ID (GID) prefixed with the ‘#’ character (e.g.,
165                 #0 for GID 0).  When running a command as a GID, many shells
166                 require that the ‘#’ be escaped with a backslash (‘\’).  If
167                 no -u option is specified, the command will be run as the
168                 invoking user.  In either case, the primary group will be set
169                 to group.  The sudoers policy permits any of the target
170                 user's groups to be specified via the -g option as long as
171                 the -P option is not in use.
172
173     -H, --set-home
174                 Request that the security policy set the HOME environment
175                 variable to the home directory specified by the target user's
176                 password database entry.  Depending on the policy, this may
177                 be the default behavior.
178
179     -h, --help  Display a short help message to the standard output and exit.
180
181     -h host, --host=host
182                 Run the command on the specified host if the security policy
183                 plugin supports remote commands.  Note that the sudoers plug‐
184                 in does not currently support running remote commands.  This
185                 may also be used in conjunction with the -l option to list a
186                 user's privileges for the remote host.
187
188     -i, --login
189                 Run the shell specified by the target user's password data‐
190                 base entry as a login shell.  This means that login-specific
191                 resource files such as .profile, .bash_profile or .login will
192                 be read by the shell.  If a command is specified, it is
193                 passed to the shell for execution via the shell's -c option.
194                 If no command is specified, an interactive shell is executed.
195                 sudo attempts to change to that user's home directory before
196                 running the shell.  The command is run with an environment
197                 similar to the one a user would receive at log in.  Note that
198                 most shells behave differently when a command is specified as
199                 compared to an interactive session; consult the shell's man‐
200                 ual for details.  The Command environment section in the
201                 sudoers(5) manual documents how the -i option affects the
202                 environment in which a command is run when the sudoers policy
203                 is in use.
204
205     -K, --remove-timestamp
206                 Similar to the -k option, except that it removes the user's
207                 cached credentials entirely and may not be used in conjunc‐
208                 tion with a command or other option.  This option does not
209                 require a password.  Not all security policies support cre‐
210                 dential caching.
211
212     -k, --reset-timestamp
213                 When used without a command, invalidates the user's cached
214                 credentials.  In other words, the next time sudo is run a
215                 password will be required.  This option does not require a
216                 password and was added to allow a user to revoke sudo permis‐
217                 sions from a .logout file.
218
219                 When used in conjunction with a command or an option that may
220                 require a password, this option will cause sudo to ignore the
221                 user's cached credentials.  As a result, sudo will prompt for
222                 a password (if one is required by the security policy) and
223                 will not update the user's cached credentials.
224
225                 Not all security policies support credential caching.
226
227     -l, --list  If no command is specified, list the allowed (and forbidden)
228                 commands for the invoking user (or the user specified by the
229                 -U option) on the current host.  A longer list format is used
230                 if this option is specified multiple times and the security
231                 policy supports a verbose output format.
232
233                 If a command is specified and is permitted by the security
234                 policy, the fully-qualified path to the command is displayed
235                 along with any command line arguments.  If a command is spec‐
236                 ified but not allowed by the policy, sudo will exit with a
237                 status value of 1.
238
239     -n, --non-interactive
240                 Avoid prompting the user for input of any kind.  If a pass‐
241                 word is required for the command to run, sudo will display an
242                 error message and exit.
243
244     -P, --preserve-groups
245                 Preserve the invoking user's group vector unaltered.  By
246                 default, the sudoers policy will initialize the group vector
247                 to the list of groups the target user is a member of.  The
248                 real and effective group-IDs, however, are still set to match
249                 the target user.
250
251     -p prompt, --prompt=prompt
252                 Use a custom password prompt with optional escape sequences.
253                 The following percent (‘%’) escape sequences are supported by
254                 the sudoers policy:
255
256                 %H  expanded to the host name including the domain name (on
257                     if the machine's host name is fully qualified or the fqdn
258                     option is set in sudoers(5))
259
260                 %h  expanded to the local host name without the domain name
261
262                 %p  expanded to the name of the user whose password is being
263                     requested (respects the rootpw, targetpw, and runaspw
264                     flags in sudoers(5))
265
266                 %U  expanded to the login name of the user the command will
267                     be run as (defaults to root unless the -u option is also
268                     specified)
269
270                 %u  expanded to the invoking user's login name
271
272                 %%  two consecutive ‘%’ characters are collapsed into a sin‐
273                     gle ‘%’ character
274
275                 The custom prompt will override the default prompt specified
276                 by either the security policy or the SUDO_PROMPT environment
277                 variable.  On systems that use PAM, the custom prompt will
278                 also override the prompt specified by a PAM module unless the
279                 passprompt_override flag is disabled in sudoers.
280
281     -R directory, --chroot=directory
282                 Change to the specified root directory (see chroot(8)) before
283                 running the command.  The security policy may return an error
284                 if the user does not have permission to specify the root
285                 directory.
286
287     -r role, --role=role
288                 Run the command with an SELinux security context that
289                 includes the specified role.
290
291     -S, --stdin
292                 Write the prompt to the standard error and read the password
293                 from the standard input instead of using the terminal device.
294
295     -s, --shell
296                 Run the shell specified by the SHELL environment variable if
297                 it is set or the shell specified by the invoking user's pass‐
298                 word database entry.  If a command is specified, it is passed
299                 to the shell for execution via the shell's -c option.  If no
300                 command is specified, an interactive shell is executed.  Note
301                 that most shells behave differently when a command is speci‐
302                 fied as compared to an interactive session; consult the
303                 shell's manual for details.
304
305     -t type, --type=type
306                 Run the command with an SELinux security context that
307                 includes the specified type.  If no type is specified, the
308                 default type is derived from the role.
309
310     -U user, --other-user=user
311                 Used in conjunction with the -l option to list the privileges
312                 for user instead of for the invoking user.  The security pol‐
313                 icy may restrict listing other users' privileges.  The
314                 sudoers policy only allows root or a user with the ALL privi‐
315                 lege on the current host to use this option.
316
317     -T timeout, --command-timeout=timeout
318                 Used to set a timeout for the command.  If the timeout
319                 expires before the command has exited, the command will be
320                 terminated.  The security policy may restrict the ability to
321                 set command timeouts.  The sudoers policy requires that user-
322                 specified timeouts be explicitly enabled.
323
324     -u user, --user=user
325                 Run the command as a user other than the default target user
326                 (usually root).  The user may be either a user name or a
327                 numeric user-ID (UID) prefixed with the ‘#’ character (e.g.,
328                 #0 for UID 0).  When running commands as a UID, many shells
329                 require that the ‘#’ be escaped with a backslash (‘\’).  Some
330                 security policies may restrict UIDs to those listed in the
331                 password database.  The sudoers policy allows UIDs that are
332                 not in the password database as long as the targetpw option
333                 is not set.  Other security policies may not support this.
334
335     -V, --version
336                 Print the sudo version string as well as the version string
337                 of the security policy plugin and any I/O plugins.  If the
338                 invoking user is already root the -V option will display the
339                 arguments passed to configure when sudo was built and plugins
340                 may display more verbose information such as default options.
341
342     -v, --validate
343                 Update the user's cached credentials, authenticating the user
344                 if necessary.  For the sudoers plugin, this extends the sudo
345                 timeout for another 5 minutes by default, but does not run a
346                 command.  Not all security policies support cached creden‐
347                 tials.
348
349     --          The -- option indicates that sudo should stop processing com‐
350                 mand line arguments.
351
352     Options that take a value may only be specified once unless otherwise
353     indicated in the description.  This is to help guard against problems
354     caused by poorly written scripts that invoke sudo with user-controlled
355     input.
356
357     Environment variables to be set for the command may also be passed on the
358     command line in the form of VAR=value, e.g.,
359     LD_LIBRARY_PATH=/usr/local/pkg/lib.  Variables passed on the command line
360     are subject to restrictions imposed by the security policy plugin.  The
361     sudoers policy subjects variables passed on the command line to the same
362     restrictions as normal environment variables with one important excep‐
363     tion.  If the setenv option is set in sudoers, the command to be run has
364     the SETENV tag set or the command matched is ALL, the user may set vari‐
365     ables that would otherwise be forbidden.  See sudoers(5) for more infor‐
366     mation.
367

COMMAND EXECUTION

369     When sudo executes a command, the security policy specifies the execution
370     environment for the command.  Typically, the real and effective user and
371     group and IDs are set to match those of the target user, as specified in
372     the password database, and the group vector is initialized based on the
373     group database (unless the -P option was specified).
374
375     The following parameters may be specified by security policy:
376
377     ·  real and effective user-ID
378
379     ·  real and effective group-ID
380
381     ·  supplementary group-IDs
382
383     ·  the environment list
384
385     ·  current working directory
386
387     ·  file creation mode mask (umask)
388
389     ·  SELinux role and type
390
391     ·  scheduling priority (aka nice value)
392
393   Process model
394     There are two distinct ways sudo can run a command.
395
396     If an I/O logging plugin is configured or if the security policy explic‐
397     itly requests it, a new pseudo-terminal (“pty”) is allocated and fork(2)
398     is used to create a second sudo process, referred to as the monitor.  The
399     monitor creates a new terminal session with itself as the leader and the
400     pty as its controlling terminal, calls fork(2), sets up the execution
401     environment as described above, and then uses the execve(2) system call
402     to run the command in the child process.  The monitor exists to relay job
403     control signals between the user's existing terminal and the pty the com‐
404     mand is being run in.  This makes it possible to suspend and resume the
405     command.  Without the monitor, the command would be in what POSIX terms
406     an “orphaned process group” and it would not receive any job control sig‐
407     nals from the kernel.  When the command exits or is terminated by a sig‐
408     nal, the monitor passes the command's exit status to the main sudo
409     process and exits.  After receiving the command's exit status, the main
410     sudo passes the command's exit status to the security policy's close
411     function and exits.
412
413     If no pty is used, sudo calls fork(2), sets up the execution environment
414     as described above, and uses the execve(2) system call to run the command
415     in the child process.  The main sudo process waits until the command has
416     completed, then passes the command's exit status to the security policy's
417     close function and exits.  As a special case, if the policy plugin does
418     not define a close function, sudo will execute the command directly
419     instead of calling fork(2) first.  The sudoers policy plugin will only
420     define a close function when I/O logging is enabled, a pty is required,
421     or the pam_session or pam_setcred options are enabled.  Note that
422     pam_session and pam_setcred are enabled by default on systems using PAM.
423
424     On systems that use PAM, the security policy's close function is respon‐
425     sible for closing the PAM session.  It may also log the command's exit
426     status.
427
428   Signal handling
429     When the command is run as a child of the sudo process, sudo will relay
430     signals it receives to the command.  The SIGINT and SIGQUIT signals are
431     only relayed when the command is being run in a new pty or when the sig‐
432     nal was sent by a user process, not the kernel.  This prevents the com‐
433     mand from receiving SIGINT twice each time the user enters control-C.
434     Some signals, such as SIGSTOP and SIGKILL, cannot be caught and thus will
435     not be relayed to the command.  As a general rule, SIGTSTP should be used
436     instead of SIGSTOP when you wish to suspend a command being run by sudo.
437
438     As a special case, sudo will not relay signals that were sent by the com‐
439     mand it is running.  This prevents the command from accidentally killing
440     itself.  On some systems, the reboot(8) command sends SIGTERM to all non-
441     system processes other than itself before rebooting the system.  This
442     prevents sudo from relaying the SIGTERM signal it received back to
443     reboot(8), which might then exit before the system was actually rebooted,
444     leaving it in a half-dead state similar to single user mode.  Note, how‐
445     ever, that this check only applies to the command run by sudo and not any
446     other processes that the command may create.  As a result, running a
447     script that calls reboot(8) or shutdown(8) via sudo may cause the system
448     to end up in this undefined state unless the reboot(8) or shutdown(8) are
449     run using the exec() family of functions instead of system() (which
450     interposes a shell between the command and the calling process).
451
452     If no I/O logging plugins are loaded and the policy plugin has not
453     defined a close() function, set a command timeout or required that the
454     command be run in a new pty, sudo may execute the command directly
455     instead of running it as a child process.
456
457   Plugins
458     Plugins may be specified via Plugin directives in the sudo.conf(5) file.
459     They may be loaded as dynamic shared objects (on systems that support
460     them), or compiled directly into the sudo binary.  If no sudo.conf(5)
461     file is present, or if it doesn't contain any Plugin lines, sudo will use
462     sudoers(5) for the policy, auditing and I/O logging plugins.  See the
463     sudo.conf(5) manual for details of the /etc/sudo.conf file and the
464     sudo_plugin(5) manual for more information about the sudo plugin archi‐
465     tecture.
466

EXIT VALUE

468     Upon successful execution of a command, the exit status from sudo will be
469     the exit status of the program that was executed.  If the command termi‐
470     nated due to receipt of a signal, sudo will send itself the same signal
471     that terminated the command.
472
473     If the -l option was specified without a command, sudo will exit with a
474     value of 0 if the user is allowed to run sudo and they authenticated suc‐
475     cessfully (as required by the security policy).  If a command is speci‐
476     fied with the -l option, the exit value will only be 0 if the command is
477     permitted by the security policy, otherwise it will be 1.
478
479     If there is an authentication failure, a configuration/permission problem
480     or if the given command cannot be executed, sudo exits with a value of 1.
481     In the latter case, the error string is printed to the standard error.
482     If sudo cannot stat(2) one or more entries in the user's PATH, an error
483     is printed to the standard error.  (If the directory does not exist or if
484     it is not really a directory, the entry is ignored and no error is
485     printed.)  This should not happen under normal circumstances.  The most
486     common reason for stat(2) to return “permission denied” is if you are
487     running an automounter and one of the directories in your PATH is on a
488     machine that is currently unreachable.
489

SECURITY NOTES

491     sudo tries to be safe when executing external commands.
492
493     To prevent command spoofing, sudo checks "." and "" (both denoting cur‐
494     rent directory) last when searching for a command in the user's PATH (if
495     one or both are in the PATH).  Note, however, that the actual PATH envi‐
496     ronment variable is not modified and is passed unchanged to the program
497     that sudo executes.
498
499     Users should never be granted sudo privileges to execute files that are
500     writable by the user or that reside in a directory that is writable by
501     the user.  If the user can modify or replace the command there is no way
502     to limit what additional commands they can run.
503
504     Please note that sudo will normally only log the command it explicitly
505     runs.  If a user runs a command such as sudo su or sudo sh, subsequent
506     commands run from that shell are not subject to sudo's security policy.
507     The same is true for commands that offer shell escapes (including most
508     editors).  If I/O logging is enabled, subsequent commands will have their
509     input and/or output logged, but there will not be traditional logs for
510     those commands.  Because of this, care must be taken when giving users
511     access to commands via sudo to verify that the command does not inadver‐
512     tently give the user an effective root shell.  For more information,
513     please see the Preventing shell escapes section in sudoers(5).
514
515     To prevent the disclosure of potentially sensitive information, sudo dis‐
516     ables core dumps by default while it is executing (they are re-enabled
517     for the command that is run).  This historical practice dates from a time
518     when most operating systems allowed set-user-ID processes to dump core by
519     default.  To aid in debugging sudo crashes, you may wish to re-enable
520     core dumps by setting “disable_coredump” to false in the sudo.conf(5)
521     file as follows:
522
523           Set disable_coredump false
524
525     See the sudo.conf(5) manual for more information.
526

ENVIRONMENT

528     sudo utilizes the following environment variables.  The security policy
529     has control over the actual content of the command's environment.
530
531     EDITOR           Default editor to use in -e (sudoedit) mode if neither
532                      SUDO_EDITOR nor VISUAL is set.
533
534     MAIL             Set to the mail spool of the target user when the -i
535                      option is specified or when env_reset is enabled in
536                      sudoers (unless MAIL is present in the env_keep list).
537
538     HOME             Set to the home directory of the target user when the -i
539                      or -H options are specified, when the -s option is spec‐
540                      ified and set_home is set in sudoers, when
541                      always_set_home is enabled in sudoers, or when env_reset
542                      is enabled in sudoers and HOME is not present in the
543                      env_keep list.
544
545     LOGNAME          Set to the login name of the target user when the -i
546                      option is specified, when the set_logname option is
547                      enabled in sudoers or when the env_reset option is
548                      enabled in sudoers (unless LOGNAME is present in the
549                      env_keep list).
550
551     PATH             May be overridden by the security policy.
552
553     SHELL            Used to determine shell to run with -s option.
554
555     SUDO_ASKPASS     Specifies the path to a helper program used to read the
556                      password if no terminal is available or if the -A option
557                      is specified.
558
559     SUDO_COMMAND     Set to the command run by sudo, including command line
560                      arguments.  The command line arguments are truncated at
561                      4096 characters to prevent a potential execution error.
562
563     SUDO_EDITOR      Default editor to use in -e (sudoedit) mode.
564
565     SUDO_GID         Set to the group-ID of the user who invoked sudo.
566
567     SUDO_PROMPT      Used as the default password prompt unless the -p option
568                      was specified.
569
570     SUDO_PS1         If set, PS1 will be set to its value for the program
571                      being run.
572
573     SUDO_UID         Set to the user-ID of the user who invoked sudo.
574
575     SUDO_USER        Set to the login name of the user who invoked sudo.
576
577     USER             Set to the same value as LOGNAME, described above.
578
579     VISUAL           Default editor to use in -e (sudoedit) mode if
580                      SUDO_EDITOR is not set.
581

FILES

583     /etc/sudo.conf            sudo front end configuration
584

EXAMPLES

586     Note: the following examples assume a properly configured security pol‐
587     icy.
588
589     To get a file listing of an unreadable directory:
590
591           $ sudo ls /usr/local/protected
592
593     To list the home directory of user yaz on a machine where the file system
594     holding ~yaz is not exported as root:
595
596           $ sudo -u yaz ls ~yaz
597
598     To edit the index.html file as user www:
599
600           $ sudoedit -u www ~www/htdocs/index.html
601
602     To view system logs only accessible to root and users in the adm group:
603
604           $ sudo -g adm more /var/log/syslog
605
606     To run an editor as jim with a different primary group:
607
608           $ sudoedit -u jim -g audio ~jim/sound.txt
609
610     To shut down a machine:
611
612           $ sudo shutdown -r +15 "quick reboot"
613
614     To make a usage listing of the directories in the /home partition.  Note
615     that this runs the commands in a sub-shell to make the cd and file redi‐
616     rection work.
617
618           $ sudo sh -c "cd /home ; du -s * | sort -rn > USAGE"
619

DIAGNOSTICS

621     Error messages produced by sudo include:
622
623     editing files in a writable directory is not permitted
624           By default, sudoedit does not permit editing a file when any of the
625           parent directories are writable by the invoking user.  This avoids
626           a race condition that could allow the user to overwrite an arbi‐
627           trary file.  See the sudoedit_checkdir option in sudoers(5) for
628           more information.
629
630     editing symbolic links is not permitted
631           By default, sudoedit does not follow symbolic links when opening
632           files.  See the sudoedit_follow option in sudoers(5) for more
633           information.
634
635     effective uid is not 0, is sudo installed setuid root?
636           sudo was not run with root privileges.  The sudo binary must be
637           owned by the root user and have the set-user-ID bit set.  Also, it
638           must not be located on a file system mounted with the ‘nosuid’
639           option or on an NFS file system that maps uid 0 to an unprivileged
640           uid.
641
642     effective uid is not 0, is sudo on a file system with the 'nosuid' option
643           set or an NFS file system without root privileges?
644           sudo was not run with root privileges.  The sudo binary has the
645           proper owner and permissions but it still did not run with root
646           privileges.  The most common reason for this is that the file sys‐
647           tem the sudo binary is located on is mounted with the ‘nosuid’
648           option or it is an NFS file system that maps uid 0 to an unprivi‐
649           leged uid.
650
651     fatal error, unable to load plugins
652           An error occurred while loading or initializing the plugins speci‐
653           fied in sudo.conf(5).
654
655     invalid environment variable name
656           One or more environment variable names specified via the -E option
657           contained an equal sign (‘=’).  The arguments to the -E option
658           should be environment variable names without an associated value.
659
660     no password was provided
661           When sudo tried to read the password, it did not receive any char‐
662           acters.  This may happen if no terminal is available (or the -S
663           option is specified) and the standard input has been redirected
664           from /dev/null.
665
666     a terminal is required to read the password
667           sudo needs to read the password but there is no mechanism available
668           for it to do so.  A terminal is not present to read the password
669           from, sudo has not been configured to read from the standard input,
670           the -S option was not used, and no askpass helper has been speci‐
671           fied either via the sudo.conf(5) file or the SUDO_ASKPASS environ‐
672           ment variable.
673
674     no writable temporary directory found
675           sudoedit was unable to find a usable temporary directory in which
676           to store its intermediate files.
677
678     sudo must be owned by uid 0 and have the setuid bit set
679           sudo was not run with root privileges.  The sudo binary does not
680           have the correct owner or permissions.  It must be owned by the
681           root user and have the set-user-ID bit set.
682
683     sudoedit is not supported on this platform
684           It is only possible to run sudoedit on systems that support setting
685           the effective user-ID.
686
687     timed out reading password
688           The user did not enter a password before the password timeout (5
689           minutes by default) expired.
690
691     you do not exist in the passwd database
692           Your user-ID does not appear in the system passwd database.
693
694     you may not specify environment variables in edit mode
695           It is only possible to specify environment variables when running a
696           command.  When editing a file, the editor is run with the user's
697           environment unmodified.
698

SEE ALSO

700     su(1), stat(2), login_cap(3), passwd(5), sudo.conf(5), sudo_plugin(5),
701     sudoers(5), sudoers_timestamp(5), sudoreplay(8), visudo(8)
702

HISTORY

704     See the HISTORY file in the sudo distribution (https://www.sudo.ws/his
705     tory.html) for a brief history of sudo.
706

AUTHORS

708     Many people have worked on sudo over the years; this version consists of
709     code written primarily by:
710
711           Todd C. Miller
712
713     See the CONTRIBUTORS file in the sudo distribution
714     (https://www.sudo.ws/contributors.html) for an exhaustive list of people
715     who have contributed to sudo.
716

CAVEATS

718     There is no easy way to prevent a user from gaining a root shell if that
719     user is allowed to run arbitrary commands via sudo.  Also, many programs
720     (such as editors) allow the user to run commands via shell escapes, thus
721     avoiding sudo's checks.  However, on most systems it is possible to pre‐
722     vent shell escapes with the sudoers(5) plugin's noexec functionality.
723
724     It is not meaningful to run the cd command directly via sudo, e.g.,
725
726           $ sudo cd /usr/local/protected
727
728     since when the command exits the parent process (your shell) will still
729     be the same.  Please see the EXAMPLES section for more information.
730
731     Running shell scripts via sudo can expose the same kernel bugs that make
732     set-user-ID shell scripts unsafe on some operating systems (if your OS
733     has a /dev/fd/ directory, set-user-ID shell scripts are generally safe).
734

BUGS

736     If you feel you have found a bug in sudo, please submit a bug report at
737     https://bugzilla.sudo.ws/
738

SUPPORT

740     Limited free support is available via the sudo-users mailing list, see
741     https://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
742     the archives.
743

DISCLAIMER

745     sudo is provided “AS IS” and any express or implied warranties, includ‐
746     ing, but not limited to, the implied warranties of merchantability and
747     fitness for a particular purpose are disclaimed.  See the LICENSE file
748     distributed with sudo or https://www.sudo.ws/license.html for complete
749     details.
750
751Sudo 1.9.5p2                   September 1, 2020                  Sudo 1.9.5p2
Impressum