DISPLAY variable

Phil Karn karn at ka9q.net
Sat Jul 21 23:58:05 EST 2001


While we're on the subject of connections to the local X forwarding port,
here's a nit of my own.

When I slogin to a remote host with X forwarding enabled, the remote
shell sets

DISPLAY=foo.bar.com:10.0

(pick your own display number here) where "foo.bar.com" is the remote
machine's host name.

This works fine as long as there's a valid DNS address entry for that
hostname. But if the remote hostname does not correspond to the correct
IP address, X forwarding fails.

Why should this happen? I have a laptop which normally sits on my
home network, and its host name reflects this fact. But occasionally
I take it into the office, obtain an IP address with DHCP and slogin into
it from my desktop using that IP address. Then the DISPLAY variable
setting is incorrect.

True, I could set things up to change the host name on the laptop to
that provided by DHCP, but I'd rather not do that. (It shows up in
outbound email, for example.) Besides, there's a very simple fix:
slogin should simply set DISPLAY=127.0.0.1:10.0 (or whatever)
regardless of location.

Phil






More information about the openssh-unix-dev mailing list