Operating System - HP-UX
1752735 Members
5634 Online
108789 Solutions
New Discussion юеВ

User login sets env variable, but where from?

 
Russ Hancock_1
Frequent Advisor

User login sets env variable, but where from?

I have an environment variable that is being set at login for all users of a machine, but I cannot find where it is being set.
I've tried the usual suspects of /etc/profile and $HOME/.profile neither have this env set.!?

I even tried resetting the env variable to what I want in /etc/profile and it doesn't appear to have any effect. Or is being over written later on ?

Can someone suggest where else I could look? And or explain the login process?

Thanks in advance,
Russ.
Russ
16 REPLIES 16
Piergiacomo Perini
Trusted Contributor

Re: User login sets env variable, but where from?

Hi Russ,

a quick hint :
check in home dir if
exist file named ".shrc" or ".kshrc".

regards
Russ Hancock_1
Frequent Advisor

Re: User login sets env variable, but where from?

Nope, neither of those files exist.
Russ
Robert-Jan Goossens
Honored Contributor

Re: User login sets env variable, but where from?

Hi,

add a set -x to the first line in the /etc/profile

# su - user_name

check the output and remove the set -x again. It will give you some hints where to look.

Hope this helps,
Robert-Jan
Luk Vandenbussche
Honored Contributor

Re: User login sets env variable, but where from?

Hi Russ,

What is your shell? (ksh, csh, sh, bash?)

echo $SHELL
Ralph Grothe
Honored Contributor

Re: User login sets env variable, but where from?

I guess you're not referring to the minimal environment set up by login?
(those are named in manpages login, environ)

Are you users' login shells C shell compatibles?
Then look for /etc/csh.login or $HOME/.login

Other shells source their own initialization files (e.g. bash would look for .bash_profile)

Madness, thy name is system administration
Russ Hancock_1
Frequent Advisor

Re: User login sets env variable, but where from?

OK then I'm using the sh shell.

If I do an su - username, the environment sets correctly, If I simply open a term window and check the env's they are wrong.

So using the set -x (thanks) I can see the /etc/profile gets read.

I guess my new qestion is why is the /etc/profile not getting read on login. AND/OR where is the environment for this machien being set??
Russ
Stephen Keane
Honored Contributor

Re: User login sets env variable, but where from?

It may help if you told us what the environment variable is?

Can you grep for it in /etc/rc.config.d/* just in case it's a system env var.

Piergiacomo Perini
Trusted Contributor

Re: User login sets env variable, but where from?

hi again,

maybe you are using a X windows and ".dtprofile" (or something like that)
override other settings?

regards
Alex Glennie
Honored Contributor

Re: User login sets env variable, but where from?

If under X/CDE ->

vi $HOME/.Xresources

*loginShell:True

restart X/CDE ...

xterm,dtterm or hpterm do not read the systems or users .profile by default.