Bug 109 - "sudo su -p" does not preserve the environment
"sudo su -p" does not preserve the environment
Status: RESOLVED INVALID
Product: Sudo
Classification: Unclassified
Component: Sudo
1.6.7
All Linux
: high high
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2003-04-29 13:40 MDT by Greg Steele
Modified: 2004-01-18 00:38 MST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Steele 2003-04-29 13:40:07 MDT
According to the documentation for su, the "-p" option should preserve the 
environment variables `HOME', `USER', `LOGNAME',or `SHELL'. When executed from 
the login shell, these variables are preserved. When executed using 
sudo, 'HOME' is preserved, but 'USER' and 'LOGNAME' are set to 'root'.
Comment 1 Todd C. Miller 2004-01-17 20:38:43 MST
Sudo sets USER and LOGNAME to the target user.  If you don't want this, you can 
use a line like this in sudoers:

Defaults    !set_logname