sudo and PATH?
Derek Broughton
news at pointerstop.ca
Mon Jan 8 14:01:18 UTC 2007
Matt Price wrote:
> On Fri, 2007-05-01 at 15:35 -0400, Derek Broughton wrote:
>>
>> Sure, but where is that set... You could do it in root's .bash* scripts,
>> but better here:
>>
>> derek at othello:~$ egrep "^ENV_\w*PATH" /etc/login.defs
>> ENV_SUPATH \
>>
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
>> ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
>
> thanks derek, nice to know. buti s sudo's PASTH set here? I think not;
> I changed the env_supath to:
> ENV_SUPATH \
>
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/local/scripts
> to no effect. I think sudo gets its paths from somewhere else;
> ![ sudo = root]. At least so it seems to me.
>
hmmm. Further investigation shows something interesting:
derek at othello:~$ sudo echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
OK, that's _my_ path (not root's).
derek at othello:~$ sudo -i
root at othello:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
Those are the two paths set in login.defs, but the one you get directly
using sudo, rather than using sudo to get a shell, appears to be mine.
otoh, I would have thought that was good enough for what you wanted.
--
derek
More information about the ubuntu-users
mailing list