why does my $PATH keeps changing
Hi all
I got redhat 6.5, and every once in a while my $PATH variable for root user changes. I am getting really really pissed off about this. It is always the same: /usr/sbin disappears and I have to add it back. I think it is one of the tcl shell environments that the other users on this machine like to use so much causing it but I can't be sure. anyway I can check? |
What do you mean you have to "add it back"? Where does it disappear from?
|
my root user's $PATH.
Code:
# echo $PATH the /usr/sbin is what keeps disappearing. |
I understand that, I mean the PATH gets set by root's login scripts, .bashrc, .profile, etc. just like regular users, so which login script is /usr/sbin disappearing from and where are you adding it back?
On my CentOS system, /usr/sbin gets added to root's PATH in /etc/profile: Code:
if [ "$EUID" = "0" ]; then |
As suicidaleggroll points out, the environment depends on how you get root...
1. Login as root - you get root's full environment 2. su - to root from user login, you get root's full environment 3. su to root from user login, you retain user's environment |
Hey all,
So right now I can't reproduce this but next time it happens I will take another look. So here is my user's path: as you can see it has all the directories that I need in it. Code:
$ echo $PATH Code:
$ su root and if I do this: Code:
# su root - but at some point even when I do Code:
su root - |
Code:
su root - Code:
su - What you're looking for is Code:
su - root |
AAAAAHHH
ok, now it makes sense. thank you. It works as advertised now. |
All times are GMT -5. The time now is 04:46 AM. |