Bug 463

Summary: -H ignored in combination with -s
Product: Sudo Reporter: kbyanc
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: low    
Version: 1.7.4   
Hardware: PC   
OS: Other   

Description kbyanc 2011-01-31 18:03:10 MST
-s starts sudo in "shell" mode rather than "run" mode; -H appears to only be honored in "run" mode.  As a result, the command sudo -Hs does not reset $HOME.  Note that sudo -Hs did reset home (as documented in the man page) in sudo 1.7.2.
Comment 1 kbyanc 2011-01-31 19:40:17 MST
It it helps, I should mention that my /etc/sudoers has "Defaults env_reset" and "Defaults env_keep += "HOME" in it.  I still expected that -H would override these defaults, though.
Comment 2 Todd C. Miller 2011-02-01 15:31:03 MST
This is fixed in sudo 1.7.5 which is currently in beta test:

$ grep HOME /etc/sudoers
Defaults env_keep +="HOME"
$ sudo-1.7.5 -s
# echo $HOME
/home/millert
# exit
$ sudo-1.7.5 -sH
# echo $HOME
/root
# exit
Comment 3 Todd C. Miller 2011-03-03 09:52:06 MST
Fixed in sudo 1.7.5 and 1.8.0.