Bug 282

Summary: sudo resets HOME envar
Product: Sudo Reporter: Tushar Teredesai <sukucorp>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: VERIFIED FIXED    
Severity: normal    
Priority: normal    
Version: 1.6.9   
Hardware: PC   
OS: Linux   
Attachments: add HOME to initial_keepenv_table to preserve HOME

Description Tushar Teredesai 2008-03-09 23:58:39 MDT
Created attachment 223 [details]
add HOME to initial_keepenv_table to preserve HOME

sudo is configured with the following options: "--disable-root-mailer --enable-noargs-shell --without-mail-if-no-user --disable-pam-session --without-lecture --without-sendmail --with-logging=file --without-pam". The sudoers file is the default that is installed by the package. As root, when I execute the command:
  HOME=<some_dir> sudo -u <some_user>
HOME is set to /root (root's home dir) not <some_dir>. As per the documentation, sudo should not mess with the HOME envar unless -H or -i is specified.

To fix it, I added HOME to the initial_keepenv_table (patch attached).
Comment 1 Todd C. Miller 2008-03-13 07:35:37 MDT
You are correct; I've fixed this in the sudo cvs tree.