LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   do profiles override each other? (https://www.linuxquestions.org/questions/linux-newbie-8/do-profiles-override-each-other-84192/)

nightfox02 08-21-2003 10:31 AM

do profiles override each other?
 
I am currently having a problem with setting the PATH for all users...

I want my path to include the apache and postgresql binaries. However, when I open and edit /etc/profile as root the path seems to vanish when i change users....

The only thing I can think of is that when i change users the individual user profile is overriding the system profile....

Is this the way linux works?

jailbait 08-21-2003 01:09 PM

"Is this the way linux works?"

Yes, try changing the PATH in the user profile. Or you could set the user profile so that it appends files to the default PATH rather than overriding it.

Also, the way that the PATH is set and changed is highly distribution dependent so what I am telling you may be done differently on your distribution.

nightfox02 08-21-2003 01:20 PM

Using Suse 8.2
 
Actually, I am using Suse 8.2...if what you said about the system still applies to SuSE please let me know...Thanks for your help

jailbait 08-21-2003 03:20 PM

The way that SuSE recommends changing the PATH is this:

SuSE sets the default PATH in /etc/profile. They recommend that you do not change /etc/profile because SuSE will clobber your changes whenever you upgrade to a new SuSE release.

They recommend that you make your changes in /etc/profile.local and they will try to preserve that file during upgrades. If /etc/profile.local does not exist you can create it and the boot scripts will run it automatically at boot time. Make your changes as additions to the PATH, not as a replacement. Example:

In /etc/profile.local I placed the command:
export PATH=$PATH:/root/data/commands
which adds a file to the end of my existing PATH.

It is possible to configure the PATH for a user. SuSE combines the functions of .profile and .bashrc into .bashrc. So, if you want to make a PATH unique for a particular user then you would add an export PATH command to /home/user/.bashrc. SuSE does not set the user PATH to anything different.

So getting back to your original question the answer on SuSE is: No, the login shells for user do not replace the default PATH, although they could if they wanted to.

I suspect that when you changed /etc/profile that you placed your PATH statement before the SuSE PATH statement. Later in the code SuSE clobbered your PATH statement with their own. SuSE has some elaborate code for building the PATH and in a casual scan you might not recognize that building the PATH is what they are doing. It is also possible that they changed the code for release 8.2, making it different to what I am describing.

The end result is that the most likely way to get your PATH to work on SuSE is to get rid of your additions to /etc/profile and create a /etc/profile.local that appends the apache and postgresql binaries to the default path. Then boot.


All times are GMT -5. The time now is 10:24 AM.