$HOME changed by sudo

Steve Langasek steve.langasek at ubuntu.com
Thu Feb 17 23:29:04 UTC 2011


On Thu, Feb 17, 2011 at 06:20:46PM -0500, Barry Warsaw wrote:
> On Feb 17, 2011, at 11:55 PM, Benjamin Drung wrote:

> >I detected that sudo in natty changes $HOME to /root [1]. Is this a bug
> >or a changed configuration?

> >It had the bad side effect that "sudo pbuilder" didn't find
> >~/.pbuilderrc.

> >[1] sudo sh -c 'echo $HOME'

> Isn't this an effect of sudo no longer preserving the environment by default?
> I've seen that behavior since Maverick.  It's why 'sudo -E' is now in my
> muscle memory. ;)

> $ sudo -E sh -c 'echo $HOME'

No, $HOME had been whitelisted internally.  The behavior in maverick vs.
natty is different from what I see, despite 'env_reset' being the default.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20110217/0f13efdc/attachment.pgp>


More information about the ubuntu-devel mailing list