Operating System - HP-UX
1833802 Members
2550 Online
110063 Solutions
New Discussion

Re: Use of /etc/PATH, /etc/profile, etc.

 
SOLVED
Go to solution
Vibhor Kumar Agarwal
Esteemed Contributor

Use of /etc/PATH, /etc/profile, etc.

Hi,

What's the use of /etc/PATH, /etc/profile, etc.

Because PATH variable and .profiles are different for each user.
Vibhor Kumar Agarwal
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: Use of /etc/PATH, /etc/profile, etc.

/etc/PATH and /etc/profile are used to set things that are common to each user. Settings unique to each user would go in there personal .profile file.


Pete

Pete
Vibhor Kumar Agarwal
Esteemed Contributor

Re: Use of /etc/PATH, /etc/profile, etc.

So the entries in Path and profile will be inherited by the independent ones.

That means if we have
Path=/usr/bin

Then setting in independent .profiles like

Path=/usr/sbin
will contain both or do we have to do
Path=$Path;/usr/sbin

Do we have some other things like these.
Is there anything similar in Solaris?
Vibhor Kumar Agarwal
Joseph Loo
Honored Contributor

Re: Use of /etc/PATH, /etc/profile, etc.

hi,

/etc/profile contains global environment settings for the users. individual users' settings are defined in .profile at their home directory.

/etc/PATH is define in /etc/profile.

regards.

what you do not see does not mean you should not believe
Leif Halvarsson_2
Honored Contributor

Re: Use of /etc/PATH, /etc/profile, etc.

Hi,

Setting enviroment works the same on Solaris. Please note thet there also may be other files with enviroment settings depending on user shell and login method (e.g. .login and .dtprofile).
saju_2
Respected Contributor

Re: Use of /etc/PATH, /etc/profile, etc.

Hi

I tried removing the .profile of my login and logged in again and tried to echo $PATH. The output is as expected. It shows only the path specified in /etc/PATH

During login
First /etc/PATH is taken
Second if u want any other gloabl path(common to all users)mention it in /etc/profile
Third if u want any specific path to that user mention it in that users $HOME/.profile

So execution is like

/etc/PATH
/etc/profile
/home//.profile

regards
CS
Pete Randall
Outstanding Contributor

Re: Use of /etc/PATH, /etc/profile, etc.

What remains in the path depends on how it is being set in the .profile file. If it is set with what it already contains, it will be cumulative. In your example:

PATH=$PATH:/usr/sbin

This would yield /usr/bin:/usr/sbin

If, on the other hand, the previous contents are ignored, only what you specify will remain:

PATH=/usr/sbin

This would yield just /usr/sbin.


Pete


Pete
Muthukumar_5
Honored Contributor
Solution

Re: Use of /etc/PATH, /etc/profile, etc.

/etc/profile is a file used to make user environment and settings. It sets Global environment for that login shell.

/etc/PATH contains directory locations where well-known binaries are seached while execution. which, whereis are working based on /etc/PATH file contents. It is like, find -type f -name "name"

Execution is like,

login (deamon)
|
/etc/profile
|
$HOME/.profile

/etc/PATH will be executed in /etc/profile itself.

hth.
Easy to suggest when don't know about the problem!