[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


I have to versions of 'python' binary:

[user at localhost ~]$ which -a 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

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