1833535 Members
3243 Online
110061 Solutions
New Discussion

.profile question

 
SOLVED
Go to solution
Joe Chow_1
Occasional Advisor

.profile question

Hello,

I have a question regarding users .profile

I want to provide all users a search PATH in their .profile, I know instead of add the PATH in each .profile, I can just add the PATH into the /etc/profile.

The problem is that I added the PATH to the /etc/profile but it won't work for the users. Can someone plesae shed some light here?

Here's what the /etc/profile PATH looks like:
-bash-2.05b$ more /etc/profile

# @(#)B.11.11_LR

# Default (example of) system-wide profile file (/usr/bin/sh initialization).
# This should be kept to the bare minimum every user needs.

# Ignore HUP, INT, QUIT now.

trap "" 1 2 3

# Set the default paths - Do NOT modify these.
# Modify the variables through /etc/PATH and /etc/MANPATH

PATH=/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/usr/local/bin:/usr/local/bi
n/sudo
MANPATH=/usr/share/man:/usr/contrib/man:/usr/local/man
6 REPLIES 6
Kent Ostby
Honored Contributor

Re: .profile question

Joe --

In the user profile, their path must start with something like:

PATH=$PATH:/home/fred/bin

So the $PATH means to pick up the PATH variable you have already set up.

If the user has:

PATH=/home/fred/bin

Then they override what you have instead of adding to it.

"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Alex Lavrov.
Honored Contributor
Solution

Re: .profile question

Like it says in /etc/profile:

# Set the default paths - Do NOT modify these.
# Modify the variables through /etc/PATH and /etc/MANPATH

Go to /etc/PATH and add there whatever you want. I should work.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Patrick Wallek
Honored Contributor

Re: .profile question

YOu need to check your /etc/profile and make sure that a line similar to

PATH=`cat /etc/PATH`

gets executed somewhere. If it doesn't you won't get the contents of /etc/PATH.
Joe Chow_1
Occasional Advisor

Re: .profile question

Thanks for everyone's promptly reply!

Actaully by editing the /etc/PATH works and that's what I was looking for. And it's good to know what $PATH is for as well!

Joe
Rick Garland
Honored Contributor

Re: .profile question

You can have the user's .profile say;

PATH=$PATH
export PATH

Modify the /etc/PATH to include what you want.

This way everybody gets the same PATH
Joe Chow_1
Occasional Advisor

Re: .profile question

I think my problem resolved and thanks again.

Joe