sudo
utilizes the following environment variables. The security
policy has control over the actual content of the command's
environment.
EDITOR Default editor to use in -e
(sudoedit) mode if
neither SUDO_EDITOR nor VISUAL is set.
MAIL Set to the mail spool of the target user when the
-i
option is specified or when env_reset is
enabled in sudoers (unless MAIL is present in the
env_keep list).
HOME Set to the home directory of the target user when
the -i
or -H
options are specified, when the -s
option is specified and set_home is set in
sudoers, when always_set_home is enabled in
sudoers, or when env_reset is enabled in sudoers
and HOME is not present in the env_keep list.
LOGNAME Set to the login name of the target user when the
-i
option is specified, when the set_logname
option is enabled in sudoers or when the env_reset
option is enabled in sudoers (unless LOGNAME is
present in the env_keep list).
PATH May be overridden by the security policy.
SHELL Used to determine shell to run with -s
option.
SUDO_ASKPASS Specifies the path to a helper program used to
read the password if no terminal is available or
if the -A
option is specified.
SUDO_COMMAND Set to the command run by sudo, including command
line arguments. The command line arguments are
truncated at 4096 characters to prevent a
potential execution error.
SUDO_EDITOR Default editor to use in -e
(sudoedit) mode.
SUDO_GID Set to the group-ID of the user who invoked sudo.
SUDO_PROMPT Used as the default password prompt unless the -p
option was specified.
SUDO_PS1 If set, PS1 will be set to its value for the
program being run.
SUDO_UID Set to the user-ID of the user who invoked sudo.
SUDO_USER Set to the login name of the user who invoked
sudo.
USER Set to the same value as LOGNAME, described above.
VISUAL Default editor to use in -e
(sudoedit) mode if
SUDO_EDITOR is not set.