Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PuTTY using a different localhost than specified

200 views
Skip to first unread message

sgerar...@gmail.com

unread,
Oct 9, 2019, 3:30:52 PM10/9/19
to
Hello,

I have students that are using PuTTY for X-forwarding from a remote Linux cluster. They specify the X display location as localhost:0.0, but whenever they try ti display a new window or graphic, they keep getting an error that localhost:20.0 or localhost:17.0 can't be connected to.

Is there some other setting that I'm missing, or a file somewhere that is redirecting to a different localhost address?

Thank you.

Grant Taylor

unread,
Oct 9, 2019, 11:23:51 PM10/9/19
to
On 10/9/19 1:30 PM, sgerar...@gmail.com wrote:
> Hello,

Hi,
I have no idea if it's what you're getting hit by or not, but I've been
hit by something quite similar.

TL;DR: localhost is ambiguous when you have IPv4 and IPv6 on the client
and / or server.

Work around: explicitly specify "127.0.0.1" or "::1" instead of the
name "localhost".

> Thank you.

You're welcome.

I hope that helps.



--
Grant. . . .
unix || die

Per Hedeland

unread,
Oct 11, 2019, 10:42:15 AM10/11/19
to
In article <bc9c0562-0e81-4b7d...@googlegroups.com>
sgerar...@gmail.com writes:
>
>I have students that are using PuTTY for X-forwarding from a remote
>Linux cluster. They specify the X display location as localhost:0.0, but
>whenever they try ti display a new window or graphic, they keep getting
>an error that localhost:20.0 or localhost:17.0 can't be connected to.

Those different values are to be expected - the SSH server listens on
a TCP port that must be different from the ones used by any X servers
running on that host, and different from the ones used by other X
forwardings. The OpenSSH server has a config parameter for it:

X11DisplayOffset
Specifies the first display number available for sshd(8)'s X11
forwarding. This prevents sshd from interfering with real X11
servers. The default is 10.

So, the first SSH connection with X forwarding will make the SSH
server set the environment $DISPLAY to localhost:10.0, which
corresponds to TCP port 6010 on the server host, the next one
localhost:11.0 / port 6011 and so on. X clients started on the server
host will connect to the SSH server according to $DISPLAY, the
connection is forwarded to the SSH client, which connects to the
actual X server, typically based on the $DISPLAY setting on the client
host.

And I think *this* is where your problem is - I'm not familiar with
PuTTY, but I assume that's where you specify "localhost:0.0". IMHO,
this shouldn't be needed, PuTTY should at least by default use the
$DISPLAY setting - and localhost:0.0, which means "connect to TCP port
6000", probably doesn't work, since the X server doesn't listen for
TCP connections by default.

In fact I can reproduce your problem with the OpenSSH client, which
*only* uses $DISPLAY. With my default setting of $DISPLAY, i.e.
":0.0", which means "connect via unix domain socket", X forwarding
works just fine, but

client $ export DISPLAY=localhost:0.0
client $ ssh -X server
...
server $ xterm
connect localhost port 6000: Connection refused
xterm: Xt error: Can't open display: localhost:12.0
server $

(The first line is from the OpenSSH client, failing to connect to
"localhost:0.0", while the second one is from xterm on the server.)

>Is there some other setting that I'm missing

Try not specifying an X display for PuTTY at all, maybe it will then
use $DISPLAY - or, check your $DISPLAY value (probably ":0.0"), and
specify that for PuTTY.

--Per Hedeland

0 new messages