Operating System - HP-UX
1827872 Members
1149 Online
109969 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.
Russ Hancock_1
Frequent Advisor

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

The environment var is UGII_ROOT_DIR the installation path from Unigraphics CAD product....
I cannot find a .Xresource file.
and none of the files in /etc/rc.config.d/ contain this UGII....

Thanks for the help, any other things to check?
Russ
Piergiacomo Perini
Trusted Contributor

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

It's not possible that "UGII_ROOT_DIR" is set on "application server side" i.e. on some application's configuration files ?

regards
Alex Glennie
Honored Contributor

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

Russ,

The .Xresources file is not there by default, since you are in a CAD enviroment I suspect this is your problem.

Just vi a new file or if I'm correct try this :

start a dtterm run in it dtterm -ls

does this new terminal session reflect your enviroment variables correctly now ?
Russ Hancock_1
Frequent Advisor

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

Alex, The dtterm -is does indeed set correctly, where as simply openning a dtterm is set incorrectly? Does this prove anything?
Russ
Bill Hassell
Honored Contributor

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

dtterm is unlike any 'normal' Unix login. Actually, xterm, dterm and hpterm all fall into this category. When you use Xwindows, these terminal emulators ignore normal login profiles by default. There are separate files used during login because Xwindows is primarily a graphics program and terminal connections are seldom used. OK, I know that's not the case, but the Xwindows designers seemed to think that. So when you use Xwindows, a different set of login profiles are followed which include .Xdefaults and other .X----- files.

To make Xwindow terminal emulators behave like normal Unix logins, use the loginShell environment variable as in:

echo "*loginShell: true" >> /HOME/.Xresources

Now the env variable you are expecting is not from HP-UX so it is definitely being set in the Xwindows profiles. Changing to loginShell:true should make everything the same. Now search your home directory for the env variable. It is very likely in a .X----- or a .dt----- file.


Bill Hassell, sysadmin
Ralph Grothe
Honored Contributor

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

Just another idea I got while last time fumbling with the PAM on my Linux box to enable LDAP integration.

Could it be that your users are obtaining their environment from such a name service or directory like an LDAP server?

Then apart from that also certain PAM modules could setup a user's environment on login.
Have a look at /etc/pam.conf for such a module (maybe named something like env.*)
Madness, thy name is system administration
Sandman!
Honored Contributor

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

Russ,

How about searching for a file named ".ugii_env" in the homedir of the user that owns the application.

regards!