Bug 271 - Sudoing to another account loses .profile settings
Sudoing to another account loses .profile settings
Status: RESOLVED INVALID
Product: Sudo
Classification: Unclassified
Component: Sudo
1.7.0
Sun Solaris 2.x
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-28 09:44 MST by Michael Graves
Modified: 2007-12-01 19:39 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 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.