Skip to main content
  1. Posts/

X11 forwarding request failed on channel 0

·157 words·1 min·

Forwarding X over ssh is normally fairly straightforward when you have the correct packages installed. I have another post about the errors that appear when you’re missing the xorg-x11-xauth (CentOS, Fedora, RHEL) or xauth (Debian, Ubuntu) packages.

Today’s error was a bit different. Each time I accessed a particular Debian server via ssh with X forwarding requested, I saw this:

$ ssh -YC myserver.example.com
X11 forwarding request failed on channel 0

The xauth package was installed and I found a .Xauthority file in root’s home directory. Removing the .Xauthority file and reconnecting via ssh didn’t help. After some searching, I stumbled upon a GitHub gist that had some suggestions for fixes.

On this particular server, IPv6 was disabled. That caused the error. The quickest fix was to restrict sshd to IPv4 only by adding this line to /etc/ssh/sshd_config:

AddressFamily inet

I restarted the ssh daemon and I was able to forward X applications over ssh once again.