LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-11-2007, 07:40 PM   #1
bluethumb
Member
 
Registered: Jan 2006
Distribution: RHEL 4, Scientific Linux, Centos, Ubuntu
Posts: 58

Rep: Reputation: 15
Question How does the default PATH get set on RHEL?


RHEL 5.

The default user path in bash is
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/root/bin:/home/foobar/bin
for user "foobar". I'm trying to find how /usr/kerberos/bin and /usr/local/bin get in there. The aren't in ~/.bash*, nor in /etc/bashrc, nor /etc/profile, nor /usr/include/paths.h. Those are all the places I know to look. There is no /etc/PATH or /etc/path. Is there somewhere else I should check?
 
Old 09-11-2007, 07:49 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
The PATH variable is set in a number of places as needed. Look in ~/.profile or ~/.bash_login, /etc/profile and the scripts in /etc/profile.d/. The kerberos part of the path is probably set in /etc/profile.d/krb5-workstation.sh.

Some services may also add to PATH. Try "sudo grep 'export .*PATH' /etc/* 2>/dev/null".

Last edited by jschiwal; 09-11-2007 at 07:52 PM.
 
Old 09-11-2007, 08:20 PM   #3
bluethumb
Member
 
Registered: Jan 2006
Distribution: RHEL 4, Scientific Linux, Centos, Ubuntu
Posts: 58

Original Poster
Rep: Reputation: 15
Thanks for the reply. /etc/profile.d/krb5-workstation looks promising. I had never heard of /etc/profile.d before. I would like to RTFM if I could find the FM.

/usr/local/bin is not in ~/.profile or ~/.bash_login or /etc/profile.

The only files in /etc/ which contain "PATH" and "local" are csh.login, lynx.cfg and man.config. Those don't look relevant.

The reason for my question is that some users want to have /usr/bin before /usr/local/bin in their paths. This seems questionable to me, and they could do it for themselves, but now I would really like to figure out how it could be done systemwide.
 
Old 09-11-2007, 08:27 PM   #4
digen
Member
 
Registered: Dec 2005
Location: India
Distribution: Ubuntu Feisty Fawn
Posts: 107

Rep: Reputation: 15
Check the directory /etc/skel/. IIRC that's the directory which has the startup scripts which get copied when a new account is created.
 
Old 10-27-2008, 08:54 AM   #5
petersk
Member
 
Registered: Aug 2005
Distribution: Suse
Posts: 53

Rep: Reputation: 15
I found /etc/environment in kubuntu that looks like it has the default path for everyone.
Kurt
 
Old 10-28-2008, 12:03 AM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally Posted by petersk View Post
I found /etc/environment in kubuntu that looks like it has the default path for everyone.
Kurt
Last time I checked, kubuntu isn't RHEL so how's that really going to help the OP with their question?

As for the actual path priority, really doesn't matter, /usr/bin will come before /usr/local/bin in most cases. If a user want's this preference changed, then have them set it in their own .bashrc or .bash_profile
 
Old 02-18-2009, 03:29 PM   #7
nlainus
LQ Newbie
 
Registered: Feb 2009
Location: Minneapolis
Distribution: RHEL 4 & 5
Posts: 11

Rep: Reputation: 0
I'm having a similar problem. See thread http://www.linuxquestions.org/questi...6/#post3448540

I need to find that default path as well to execute a command via ssh on another host with a shared home dir. My .bash_profile is not being sourced in certain circumstances. check it out and let me know what you think.
 
Old 12-09-2009, 10:07 AM   #8
docpneumo
LQ Newbie
 
Registered: Dec 2009
Posts: 1

Rep: Reputation: 1
In RHEL or CentOS add a script to /etc/profile.d to setup the path to your application.

eg. To add a path to ree (Ruby Enterprise Edition on my machine):

In /etc/profile.d/ree.sh
Quote:
if ! echo ${PATH} | /bin/grep -q /opt/ree/bin ; then
PATH=/opt/ree/bin:${PATH}
fi
Follow the pattern in the other scripts in /etc/profile.d to see how this was done.
 
1 members found this post helpful.
  


Reply

Tags
path


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RHEL 5 w/ Gnome - How to set 32 bit Firefox as default browser? rkmason Red Hat 2 07-01-2007 11:42 AM
RHEL WS4: change installation path ghee22 Red Hat 2 01-10-2006 10:09 AM
Set the path systemwide/Set the path for a user with Slackware jayhel Slackware 1 06-12-2005 01:24 AM
Is there a way to change source install path on RHEL? guest Linux - Newbie 1 04-11-2005 06:01 PM
How to set PATH How do I set PATH environment variable? Tranquil Linux - Newbie 3 11-02-2003 03:52 AM


All times are GMT -5. The time now is 03:38 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration