TL;DR
Disabling IPv6 necessitates SSHd AddressFamily is "inet" for X11 Forwarding to work.Issue
OpenSSH assumes both IPv6 and IPv4 protocols are enabled, and default SSHd AddressFamily value "any" is valid. Quickly skimming the OpenSSH source code, it was not obvious why SSHd does not fail gracefully, selecting only an available IP address family.Therefore, for X11 Forwarding to work correctly, in /etc/ssh/sshd_config we must choose:
- Defaults - IPv6 enabled and SSHd AddressFamily value "any"
- Custom - IPv6 disabled and SSHd AddressFamily value "inet"
Background
PuTTY was not creating a $HOME/.Xauthority file on ssh login and no X11 applications would run, despite setting $DISPLAY. PuTTY was correctly configured with:- X11 Forwarding enabled
- X display location empty
- Remote authentication protocol MIT-Magic-Cookie-1
- X authority file for local display empty
On the initial ssh login there should be a .Xauthority notice:
/usr/bin/xauth: creating new authority file /home/cleverguy/.Xauthority
Likewise, the file $HOME/.Xauthority did not exist:
$ ls -lac $HOME/.Xauthority
ls: cannot access /home/cleverguy/.Xauthority: No such file or directory
After updating the SSHd AddressFamily and restarting the service, the $HOME/.Xauthority file was created as expected on login and X11 applications worked.
$ ls -lac $HOME/.Xauthority
-rw-------. 1 cleverguy cleverguy 49 Jun 13 16:49 /home/cleverguy/.Xauthority
The X11 application "xterm" and others ran fine afterward. Solved.
Additional Information
Red Hat Bugzilla – Bug 1173052 titled "X11 forwarding fails if AddressFamily not inet and no IPV6 addresses configured" (two and a half years after this post) contains the same workarounds. Guess I should have opened a bug! :PUPDATE: Updated for new information and clarifications on 2017-JUL-05
Comments
Thank you very much
Gina
There are nearly 1 billion answers regarding X11 errors...but you seem to be the only one talking about IP configuration.
xclock
MobaXterm X11 proxy: Unsupported authorisation protocol
Error: Can't open display: localhost:10.0
please help