17

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?

  • On what OS is it? Most do have /usr/local/sbin and /usr/local/bin on root's default path, but there are exceptions. – Gilles Feb 14 '14 at 15:19
  • Just encountered a strange difference between two RHEL 6.4 VMs (one with /usr/local/bin and one without). And the one with /usr/local/bin, I couldn't find where it was being set. – batfastad Dec 23 '14 at 17:25
17

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 was GNU > /usr/local). As root 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 of make by root should be treated with caution. Better have it go the extra step of giving an explicit path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.