Operating System - HP-UX
1748237 Members
3860 Online
108759 Solutions
New Discussion юеВ

Re: /etc/profile or .profile

 
SOLVED
Go to solution
Peter Maitland
Occasional Advisor

/etc/profile or .profile

When a user logs in which takes precedence, .profile or /etc/profile. Here is the situation: in /etc/profile the last line runs exec and this brings the user to a menu. I want to point some users to a different menu and I tried to accomplish that by putting the exec in their .profile but the old menu shows up, the one that is in /etc profile. Any help would be appreciated.

Peter

4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor

Re: /etc/profile or .profile

Hi Peter,
/etc/profile is run first then .profile. There fore entries in .profile can override those in /etc/profile.
If it ain't broke, I can fix that.
Victor BERRIDGE
Honored Contributor

Re: /etc/profile or .profile

Hi,
/etc/profile is for all, and so executed before $HOME/.profile

You should have your menu in the users .profile...
Well my 2 cents...

All the best

Victor
James R. Ferguson
Acclaimed Contributor
Solution

Re: /etc/profile or .profile

Hi Peter:

/etc/profile should only contain system-wide, common initialization functions. The $HOME/.profile is the approriate place to customize functionality to an individual user's taste.

In point of fact, if you look at the "virgin" template for /etc/profile, namely 'usr/newconfig/etc/profile', you will see the comment "...system-wide profile file...This should be kept to the bare minimum every user needs".

Since /etc/profile is executed first, before $HOME/.profile, doing an 'exec' to a menu-script would mean that the $HOME/.profile would never run.

...JRF...

Re: /etc/profile or .profile

Hi Peter,

To avoid putting the menu in the .profile of every user, you could try to make one file and make a symbolic link to it from every users homedirectory.
Also, you could put a test in the /etc/profile file, to see which user is logging in and start the appropiate menu from there.