sudo and PATH?
Martin Marcher
martin.marcher at openforce.com
Tue Jan 9 09:08:13 UTC 2007
Am 08.01.2007 um 20:44 schrieb Derek Broughton:
> Martin Marcher wrote:
>
>> Am 08.01.2007 um 15:08 schrieb Derek Broughton:
>>
>> Quote:
>> env_reset If set, sudo will reset the environment to only
>> contain the
> ...
>> Defaults env_keep = "PATH" # keeps $PATH for all users
>> Defaults:YourUserName env_keep = "HOME USER PATH" # keeps HOME USER
>> PATH for YourUserName
>
> I'm sorry, I'm too dense for that. What value of PATH is being
> "kept"? I
> _think_ it means (and experiment seems to bear it out) that if "derek"
> executes "sudo XYZ" then XYZ is run with "derek"'s PATH, but if
> that's the
> default case, I'm not sure why the OP had a problem.
You are right I wasn't clear on that,
what I meant was with >>Defaults env_keep = "PATH"<< every user who
executes a sudo command will have his personal environment variable
unchanged (I can't provide examples as I'm using OS X on my desktop
and never cared about the sudo configuration, all my servers only
have a root account nothing else so it wouldn't make much sense).
similiar for the second example only the user with "YourUserName"
will have $HOME, $USER, $PATH unchanged (try executing a root shell,
but keep in mind if you >>sudo su -<< you will create a login shell
where the shell will overwrite the variables, if it's just an
interactive shell you should be able to see the difference (and I
hope I didn't mix up login, interactive and whatever type of shell
again, that's what always catches me)
martin
More information about the ubuntu-users
mailing list