Mailinglist Archive: opensuse (2348 mails)

< Previous Next >
[opensuse] Re: envvar DISPLAY not set on bash invocation fr/sshd
  • From: Sam Clemens <clemens.sam1@xxxxxxxxx>
  • Date: Tue, 01 Apr 2008 00:27:44 -0400
  • Message-id: <47F1B9C0.3000008@xxxxxxxxx>
Linda Walsh wrote:
Sam Clemens wrote:
Linda Walsh wrote: ... DISPLAY variable isn't being set
( to "[localhost:10.0]" (or anything). )

That's normally set at login, by login scripts.
On the target system, I (where bash is my shell), I am 'echo'ing
'DISPLAY' at the beginning of "/etc/profile". Isn't that the first startup
script called by bash on an interactive login?

It is 'null' on the failing machines at that point.

Remember, when you SSH to another machine, the remote machine
picks up the environment variables from the ssh that you
initiated....which inherits them from your login shell.
I normally use DISPLAY "=:0" or "=0.0" on the local machine
to talk to its X server, But use "X-Forwarding" on remote machines,
so doesn't the remote 'sshd' have to set DISPLAY to correspond to
the forwarded port?

set it to the IP address of the machine you're sitting at
before doing ssh -X

Use something like this:

#if DISPLAY is not set, set to 0.0 on current host
DISPLAY=${DISPLAY:-`hostname -i`:0.0}

So make sure that DISPLAY is properly set *BEFORE* you ssh.

Unfortunately, it isn't so easy (sigh).
Value of DISPLAY is set to ":0", and exported (verified by using
"printenv DISPLAY") in the 'ssh' case.
Same behavior in a 2nd client prog (GUI based), where it appears
to set DISPLAY in the forwarded environment to the hosts.

I verified that the GUI must be setting DISPLAY, or it wouldn't
be working. I.e. -- unsetting DISPLAY in the shell and then running
'ssh' results in the remote DISPLAY var being "null" when bash starts.

lw> printenv DISPLAY
lw> ssh working
working:lw> echo "DISPLAY=$DISPLAY"
lw> ssh fail
fail:lw> echo "DISPLAY=$DISPLAY"

I don't see how it could be on the client machine (it 'works' to another
'remote' machine as well). It's not in /etc/ssh/sshd_config as it
is the same except for the "ListenAddress". the /etc/rc.d/sshd scripts
are the same as are the /etc/sysconfig/ssh files on the two
systems. /etc/{profile,bash.bashrc} also the same on the two systems.

Maybe some login config...I wouldn't think the PAM_LIB would filter.
Anyway, that's where the problem stands.

To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
This Thread