[sudo-users] Sudo keeps using the same binary although PATH is different when invoking with sudo.

Piotr Dobrogost p at gmane-2014.dobrogost.net
Sat Mar 1 12:12:25 MST 2014


Hi!

I have to versions of 'python' binary:

[user at localhost ~]$ which -a python
/usr/local/bin/python
/usr/bin/python
[user at localhost ~]$ /usr/local/bin/python -V && /usr/bin/python -V
Python 2.7.6
Python 2.4.3

Using sudo modifies PATH as follows:

[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

Without sudo the first version on the PATH is used:

[user at localhost ~]$ python -V
Python 2.7.6

However with sudo, seeing as the PATH gets modified as showed above, I
expected /usr/bin/python to be run not /usr/local/bin/python but it seems
like it's not the case:

[user at localhost ~]$ sudo python -V
Python 2.7.6

What am I missing?




More information about the sudo-users mailing list