DISPLAY is not exported, sometimes
David A. De Graaf
dad at datix.us
Sat Jul 23 21:53:40 UTC 2011
On Sat, Jul 23, 2011 at 02:31:57PM -0500, Mikkel L. Ellertson wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 07/23/2011 02:17 PM, David A. De Graaf wrote:
> > Since doing fresh installs of Fedora 15 on two computers, I've found
> > that the DISPLAY environment variable is not exported in some cases,
> > despite being declared "exported".
> >
> > This seems to be a clear violation of the EXPORT rules in /bin/bash.
> > It is a severe handicap in a root window, since most of the GUI
> > commands in the system-config-* group will not run.
> > ...
> > Can anyone help?
> >
> I would expect the list of variable names to be different with the
> root shell invoked with su -. When you use - or -l, things are set
> just like you had logged in as that user. Because of /etc/pam.d/su,
> DISPLAY and the "cookie" that lets you access X are carried over.
> You may want to compare these 2 files, and see if they are the same
> on both machines. You may also want to check /etc/pam.d/system-auth
> to see if they point to the same file, and the files are the same.
>
> I am not sure, but it looks like a PAM problem to me.
>
> Mikkel
Thank you Mikkel, for responding.
Precisely to avoid the complexities introduced by switching to root,
I merely switched to my own userID with su - dad .
I fully (sort-of) understand the significance of the - to "make the
shell a login shell".
The original xterm window is a "login shell", or a somewhat distant
descendant, since login occured in a console, and startxfce4 conspired
to create that window, and several others. Therefore, it's environment
should be based on, or inherited from, the original login shell,
with obvious additions for X.
As I understand it (from the golden years of UNIX), what happens when
I type /bin/su - dad is roughly this:
- the shell forks, creating a child with all of the parent's exported
environment but not the rest, and including stdin, stdout, and stderr.
- the child runs login and checks the passwd for the new user
- that user's startup scripts, ie, profile, bashrc, etc. are run,
possible changing some of the environment - PATH, PS1, etc.
- a bash prompt is presented
That's it!
Since the parent's user and the child's user are the same, I would
expect the environment to be the same, or very similar.
They're not!
Some other process must be deliberately changing or undefining
variables - such as DISPLAY, but also many others.
I don't know who or why.
To answer your specific suggestions, all the files you mentioned,
/etc/pam.d/su, /etc/pam.d/system-auth, and indeed all of /etc/pam.d/
are identical on both machines.
I really don't dig PAM, but given the congruence, it's hard to
believe PAM is responsible.
--
David A. De Graaf DATIX, Inc. Hendersonville, NC
dad at datix.us www.datix.us
The most terrifying words In the English language are:
I'm from the government and I'm here to help.
- Ronald Reagan
More information about the users
mailing list