2

I connect to two different SSH servers A and B using PuTTY+Xming from Windows.

On server A, echo $DISPLAY yields localhost:10.0 (already set somehow); while on server B, I've manually set the DISPLAY variable to be localhost:10.0 as well.

However, I am able to use xclock on server A, but not on server B. The only way I could get it to work on server B is by adding server B's IP address to Xming's X0.hosts configuration AND setting the DISPLAY environment variable to my Windows machine's IP address.

My question is, how come server A's xclock works with minimal setup (just enable X11 forwarding and set display location to localhost:0.0 in PuTTY), but not server B's?

In addition, how can one look for the script that set the DISPLAY environment variable to localhost:10.0 on server A?


Additional info: 1) Server A has an ~/.Xauthority file that gets automatically created upon login, while server B does not. 2) Server B's /var/log/auth.log contained the following error: sshd[1404]: error: Failed to allocate internet-domain X11 display socket. 3) I changed the hostname of Server B once before.

silvernightstar
  • 1,885
  • 3
  • 19
  • 25
  • Related: [X11 forwarding request failed on channel 0](https://stackoverflow.com/q/38961495/55075) – kenorb Jul 15 '23 at 15:00

1 Answers1

4

After much googling, it turns out the culprit is disabled ipv6 on server B.

As a workaround, the following line needs to be added to /etc/ssh/sshd_config:

AddressFamily inet

Should now work after sudo service ssh reload.

I found the solution here and here.

silvernightstar
  • 1,885
  • 3
  • 19
  • 25
  • this worked for me too. its quite surprising that its necessary given that i am logging in to a machine with an ipv4 address from a machine with an ipv4 address on my lan. – mulllhausen Mar 27 '16 at 13:07
  • Works for me too when ssh to Debian 11 (OpenSSH_8.4p1 Debian-5+deb11u1, OpenSSL 1.1.1n 15 Mar 2022) on Fedora 36 (OpenSSH_8.8p1, OpenSSL 3.0.5 5 Jul 2022). I disabled ipv6 too on server side. – LiuYan 刘研 Sep 07 '22 at 00:57