Bug 440 - changes in 1.7.4 make sudo -H not usable
changes in 1.7.4 make sudo -H not usable
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Sudo
1.7.4
PC Other
: high normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-14 16:16 MDT by Elan Ruusamäe
Modified: 2011-03-03 09:53 MST (History)
0 users

See Also:


Attachments
Interoperability fix for HOME in env_keep and -H flag (1.81 KB, patch)
2010-09-14 16:36 MDT, Todd C. Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elan Ruusamäe 2010-09-14 16:16:19 MDT
the play that was started with 1.7.4 makes sudo unusable for me, i can no longer have two kind of shells, one where $HOME is preserved and other where $HOME is reset for target user.

seems -H is not functioning at all.

see also this mailing list post for problem report:
http://lists.pld-linux.org/mailman/pipermail/pld-devel-en/2010-August/021777.html

probably i could "detect" the situation on $SUDO_USER variable, and act on it, 
it wouldnt be so horrible, if it was just $HOME, but all kinds of user shell vars init depend on $HOME var, meaning these all needs to be overridden:

with:
Defaults env_keep += HOME

glen$ sudo -H -u builder bash -l
builder$ env | grep glen
TMPDIR=/home/glen/tmp
SUDO_USER=glen
SCREENDIR=/home/glen/.screen
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/home/glen/bin:/usr/games
PWD=/home/glen
HOME=/home/glen
TMP=/home/glen/tmp
HISTFILE=/home/glen/.history
Comment 1 Todd C. Miller 2010-09-14 16:36:42 MDT
Created attachment 293 [details]
Interoperability fix for HOME in env_keep and -H flag
Comment 2 Todd C. Miller 2010-09-14 16:37:40 MDT
I've attached a patch that is currently scheduled for sudo 1.7.5 that should address this.
Comment 3 Elan Ruusamäe 2010-09-14 16:43:05 MDT
that's a quick one! i'll test it right away! :)
Comment 4 Elan Ruusamäe 2010-09-14 17:08:42 MDT
great, seems work again!

with "Defaults env_keep += HOME" :

$ sudo env | grep HOME
HOME=/home/glen

$ sudo -H env | grep HOME
HOME=/root

$ sudo -i -H env | grep HOME
JAVA_HOME=/usr/lib/jvm/java
HOME=/root

$ sudo -V
Sudo version 1.7.4p4
(with the patch from this bug)
Comment 5 Todd C. Miller 2011-03-03 09:53:39 MST
Fixed in sudo 1.7.5 and 1.8.0.