I've noticed that the default path for root on my of my vm's and servers do not include /usr/local/bin
sudo -s
echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin
Whereas normal users on the server do have /usr/local/bin
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/sowen/bin
Why would root not need /usr/local in the path?
Where is the default path for a user defined?
Best Answer
Because it isn't set up in the relevant shell startup files for root.
Traditionally,
/usr/local
has been used for unofficial, locally installed software (often to override buggy/broken/limited "official" versions; a friend quipped that the first step when a new Sun arrived wasGNU > /usr/local
). Asroot
is all-powerful, any mistake or misdesign in the programs it runs can be fatal. It stands to reason that running e.g. a local, experimental version ofmake
by root should be treated with caution. Better have it go the extra step of giving an explicit path.