Bug 271

Summary: Sudoing to another account loses .profile settings
Product: Sudo Reporter: Michael Graves <m.graves>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED INVALID    
Severity: normal    
Priority: low    
Version: 1.7.0   
Hardware: Sun   
OS: Solaris 2.x   

Description Michael Graves 2007-11-28 09:44:45 MST
When using sudo to switch to another account (sudo account) it has been observed that some of the settings in the account's .profile are
lost.

If the account is accessed from root as su - account, this does not happen. Is there any reason/workaround for this?
Comment 1 Todd C. Miller 2007-12-01 19:39:41 MST
Those setting are set by the target user's login shell.  Since sudo runs commands, not a shell, there is no direct way for it to set them.

In recent versions of sudo you can do things like:
sudo -i -- -c "command args"

which will run a login shell and pass it a command and args to run.  I've been considering making "sudo -i command" behave in the same way but currently that will not do what you want.