[sudo-users] how sudo handles $HOME
Todd C. Miller
Todd.Miller at sudo.ws
Fri May 17 10:39:10 MDT 2019
On Thu, 16 May 2019 07:48:40 -0400, Dan Streetman wrote:
> I've cc'ed sudo-users, so the question to the upstream sudo list can
> be summarized as:
> How likely would it be for upstream sudo to add HOME to env_keep by default?
Extremely unlikely. Prior to sudo 1.7.4 the HOME and MAIL environment
variables were preserved in the environment by default. This can
lead to programs using config files the original user's home
directory, which has security implications, so the default was
changed in 1.7.4.
In the old days, sudo did little more than change the uid. These
days sudo tries to run the command in an environment that closely
matches what you would get by logging in as that user. This has
proven to be safer as it more closely matches the assumptions other
> We ask because Ubuntu carries a patch that adds HOME to env_keep,
> unlike the default upstream, or any other Linux/Unix. We are
> considering removing that patch, to match upstream defaults, of *not*
> including HOME in env_keep.
I would be supportive of that. I believe that resetting HOME is
the safer default.
More information about the sudo-users