changing /etc/profile does nothing to root PATH
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
.
Related videos on Youtube
fixer1234
Updated on September 18, 2022Comments
-
fixer1234 over 1 year
rhel 5 root has
/bin/bash
for shell. I removedpathmunge /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
?-
HikeMike almost 13 years
/etc/paths
?/etc/paths.d/*
? -
new123456 almost 13 yearsAny 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.
-