[sudo-users] Sudo keeps using the same binary although PATH is different when invoking with sudo.
Piotr Dobrogost
p at gmane-2014.dobrogost.net
Sun Mar 2 13:44:13 MST 2014
Todd C. Miller <Todd.Miller <at> courtesan.com> writes:
Thanks for replay.
> Sudo does not modify the PATH unless the secure_path option is set
> in the sudoers file. You should be able to tell if it is set (and
> to what value) by running "sudo -l".
Below is output from `sudo -l` as well as contents of /etc/sudoers file.
There's no mention of secure_path so I guess it's not enabled. Yet it looks
like PATH is being modified:
[user at localhost ~]$ echo 'echo $PATH' | sh && echo 'echo $PATH' | sudo sh
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/user/bin
/usr/bin:/bin
There's some chance it's the shell that modifies it not sudo. In that case
what command can I use to check what's the PATH when using sudo (so that
shell would not interfere)?
However in my original question, where I wonder why output from
$ python -V
and
$ sudo python -V
is the same there's no shell involved (I believe)…
[user at localhost ~]$ sudo -l
Matching Defaults entries for user on this host:
requiretty, !visiblepw, env_reset, env_keep="COLORS DISPLAY HOSTNAME
HISTSIZE INPUTRC KDEDIR LS_COLORS MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS
LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES
LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE
LINGUAS _XKB_CHARSET XAUTHORITY"
Runas and Command-specific defaults for user:
User user may run the following commands on this host:
(ALL) NOPASSWD: ALL
/etc/sudoers --- START
Defaults requiretty
Defaults !visiblepw
Defaults env_reset
Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \
LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \
LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME
LC_NUMERIC \
LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \
_XKB_CHARSET XAUTHORITY"
root ALL=(ALL) ALL
user ALL=(ALL) NOPASSWD: ALL
/etc/sudoers --- END
Regards,
Piotr Dobrogost
More information about the sudo-users
mailing list