0

rhel 5 root has /bin/bash for shell. I removed pathmunge /usr/local/sbin from /etc/profile. There is no /usr/local/sbin in /etc/profile.d/* /etc/bashrc /root/.bashrc /root/.bash_profile /root/.profile

After reboot, /usr/loca/bin still shows up in the root path.

How does rhel 5 set default PATH for root? Which config file has /usr/local/sbin?

migrated from stackoverflow.com Jun 16 '11 at 20:43

This question came from our site for professional and enthusiast programmers.

  • /etc/paths? /etc/paths.d/*? – Daniel Beck Jun 16 '11 at 20:45
  • 1
    Any reason not to go ahead and modify root's .bashrc? Also, please reformat your question - it is a little difficult to read in its current form. – new123456 Jun 17 '11 at 2:41
2

bash has a default value for PATH that is built into the binary. On RHEL it is set to /usr/local/bin:/bin:/usr/bin. Since /etc/profile and the scripts in /etc/profile.d never explicitly set PATH (they instead modify it with constructs like PATH=$PATH:/somedir), you're left with that built-in PATH as a starting point.

If you'd like get rid of this, you have to explicitly set PATH. I suggest doing it by putting

PATH=/bin:/usr/bin

At the top of /etc/profile.

Your Answer

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