[sudo-users] sudo -i does not run root's .profile when issued

Todd C. Miller Todd.Miller at courtesan.com
Thu Nov 11 10:53:43 EST 2010


In message <AANLkTi=VMFw+zNPGgqGT=CExTSw_jCNX_4hoOzzA0Waz at mail.gmail.com>
	so spake Denis Martin (dnsmrtn):

> I have "always_set_home" defined in the "Defaults" section. My understanding
> is that it "will set the HOME environment variable to the home directory of
> the target user". So in effect, it should not include $HOME.
> 
> But, there is always a "but", I found that there is also a statement that
> says:
> "Defaults              env_keep += *" which, as I understand it, does as if
> I had included HOME in the env_keep list.
> 
> Can I keep everything BUT $HOME?

I suspect what you really want is this:

    Defaults	!env_reset, always_set_home

instead of:

    Defaults	env_keep += *

That will preserve the user's environment except for $HOME.

 - todd



More information about the sudo-users mailing list