I'm confused by the following:
[user@QVr740-11 ~]$ which ninja
/usr/local/bin/ninja
[user@QVr740-11 ~]$ sudo which ninja
which: no ninja in (/sbin:/bin:/usr/sbin:/usr/bin)
[user@QVr740-11 ~]$ sudo echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin
ls -l /usr/local/bin/ninja
shows that the binary is owned by root:root, and executable by all (three x's), and $PATH
shows that even as sudo, it should be in the path, however when I go to execute which
, the path has somehow changed.
sudo -E
does not change this behaviour.
What gives? Is $PATH being preserved? Is which
looking elsewhere for a path (note that I can't execute this binary as sudo).