Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else ...
Is it possible you're sometimes accidentally running "su" instead of "su -"? The latter will update root's environment variables, the former won't.
Last edited by suicidaleggroll; 09-01-2015 at 05:23 PM.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.