Operating System - HP-UX
1834587 Members
3770 Online
110069 Solutions
New Discussion

Re: strange environment varable bahavior

 
Dave Chamberlin
Trusted Contributor

strange environment varable bahavior

Hello,
I have two identical xterm windows. I am root in both windows. An "env" shows my environments to be identical. The SHELL var is /sbin/sh. In each shell I do "su - oracle8". I become the oracle8 user in each window but "env" shows the shell to be /usr/bin/sh for one, and /sbin/sh for the other. Can anyone explain this behavior? Thanks
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor

Re: strange environment varable bahavior

This shouldn't be possible and I'm surprised that the only difference in the two evnironments is the SHELL. Compare them carefully and see if there are other differences - this might offer more clues. The only things that come to mind are small differences in the xterm instances. Are the TERM variables initially identical? stty -a initially identical? Is the SHELL set in Oracle8's .profile oe simply taken from the passwd entry.

One screwball idea is that the .profile actually looks for specific DISPLAY variable settings but you willl need to dig deeper. Try this with another user and check the results.
If it ain't broke, I can fix that.
harry d brown jr
Honored Contributor

Re: strange environment varable bahavior


DO this:

grep oracle /etc/passwd

then, check the login script for Oracle8 user, to see if you have any "funny" code that might switch shells on you.

And are the PATH's absolutely identical for both xterm windows?

live free or die
harry
Live Free or Die
Steven E. Protter
Exalted Contributor

Re: strange environment varable bahavior

in each session.

env > /tmp/session1.dat


env > /tmp/session2.dat


Then in either

diff session2.dat session1.dat

Check the /etc/passwd file and see what shell is set for the user oracle8

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Shannon Petry
Honored Contributor

Re: strange environment varable bahavior

The only way this could happen is if you did not give the "-" option to su. This would be in the window where the shell remained /sbin/sh.

The "-" option of su not only changes the shell, but process a complete login. This will void any previous variables.

When the "-" is left out, it only changes your UID and GID, and does not change your environment.



Regards,
Shannon
Microsoft. When do you want a virus today?
Dave Chamberlin
Trusted Contributor

Re: strange environment varable bahavior

The xterms are identically started - though one has bg green and the other has cyan ( I have a script that each starts from for consistency. I tried exiting as root from both windows and the settings for me were identical in both (including stty -a). I did "su - ", follwed by "su - oracle8" and the behavior repeated. I did one final test - I destroyed both and restarted both windows and now get the same env for both. A question though - could this cause any problems? I had a failed database migration on Saturday and have not yet determined the cause (see posting under databases made today).

Thanks
Shannon Petry
Honored Contributor

Re: strange environment varable bahavior

Yes, this kind of error will cause failures in specific applications.

Oracle requires a non-root ID to perform administrative tasks, as well as a specific environment. Failure of either of these 2 items will cause things to fail.

I would like to re-iterate that this most likely not a system error, but user error or display error. In 15 years working with Unix, I have never heard of ths su command not processing the login when given a "-" option, and this includes beta releases of Solaris and Linux as well as production SCO, Irix, SunOS, HP-UX, AIX, and Linux.

Most likely, this is a user or terminal error. Meaining that the terminal showed the "-" after the su command, but it was actually not there. (non-displayed eras-char, eras-word, etc...) or the "-" was omitted from the su command.

Regards,
Shannon
Microsoft. When do you want a virus today?
Wodisch
Honored Contributor

Re: strange environment varable bahavior

Hi,

check your ".profile", "/etc/profile", your ".shrc" ( more accurate: "$ENV") files for the PATH set in there (maybe there is an "if" or "case" upon your "$TERM"?

Then check your Xresources: "xrdb -query > textfile".
Do you have different resources, like "*loginShell", or "*userPATH", or something like that?
And where do your sessions get their Xresources from? "$HOME/.Xdefaults" or from the root-window's RESOURCE_MANAGER property?

FWIW,
Wodisch