I get that binaries can be in different places. What I don't understand is why when I run whereis, which and type it says vim is at /usr/bin/vim, but when I try to run it using sudo it says I can't run /bin/vim.
They are not links, and their content is the same. But I have persmission to perform sudo on /usr/bin/vim, which is not being called and I have no idea why!
[user@host conf.d]$ sudo vim test.conf
[sudo] password for user:
Sorry, user user is not allowed to execute '/bin/vim test.conf' as root on host.domain.com.br.
[user@host conf.d]$ whereis vim
vim: /usr/bin/vim /usr/share/vim /usr/share/man/man1/vim.1.gz
[user@host conf.d]$ which vim
/usr/bin/vim
[user@host conf.d]$ type vim
vim is /usr/bin/vim
[user@host conf.d]$ ll /bin/vi*
-rwxr-xr-x. 1 root root 910040 Jun 10 03:56 /bin/vi
lrwxrwxrwx. 1 root root 2 Set 30 11:38 /bin/view -> vi
-rwxr-xr-x. 1 root root 2289656 Jun 10 03:56 /bin/vim
lrwxrwxrwx. 1 root root 3 Set 30 12:14 /bin/vimdiff -> vim
-rwxr-xr-x. 1 root root 2084 Jun 10 03:56 /bin/vimtutor
[user@host conf.d]$ ll /usr/bin/vi*
-rwxr-xr-x. 1 root root 910040 Jun 10 03:56 /usr/bin/vi
lrwxrwxrwx. 1 root root 2 Set 30 11:38 /usr/bin/view -> vi
-rwxr-xr-x. 1 root root 2289656 Jun 10 03:56 /usr/bin/vim
lrwxrwxrwx. 1 root root 3 Set 30 12:14 /usr/bin/vimdiff -> vim
-rwxr-xr-x. 1 root root 2084 Jun 10 03:56 /usr/bin/vimtutor
[user@host conf.d]$ md5sum /usr/bin/vim
e5a9c498add4fa49a39a720a826f954c /usr/bin/vim
[user@host conf.d]$ md5sum /bin/vim
e5a9c498add4fa49a39a720a826f954c /bin/vim
[user@host conf.d]$
PATHpreferring/binover/usr/bin, or not even having/usr/binin it. You can check withsudo env | grep PATH, if you have permission to runsudo env. Alternatively, if you can get intosudo /usr/bin/vim, you can run:echo $PATHfrom Vim. – Bob Oct 02 '14 at 17:50secure_pathoption in/etc/sudoers(also a compile time option). – peterph Oct 02 '14 at 18:16lsresults from/binand/usr/binare identical makes me suspect that/binis a symbolic link to/usr/bin(or vice versa). – G-Man Says 'Reinstate Monica' Oct 02 '14 at 18:18/bininto/usr/binand symlink the former to the latter. You should check this. – HalosGhost Oct 03 '14 at 13:50lwhen I performls? – That Brazilian Guy Oct 03 '14 at 16:01/binor/usr/binor/usr, notvim. – Gilles 'SO- stop being evil' Oct 03 '14 at 22:51