$HOME changed by sudo

Barry Warsaw barry at ubuntu.com
Thu Feb 17 23:20:46 UTC 2011


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'

-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20110217/486b6988/attachment.pgp>


More information about the ubuntu-devel mailing list