Last updated on September 14, 2020 by Dan Nanni
First of all, we assume that you already enabled X11 forwarding over SSH properly.
If you are getting "X11 forwarding request failed on channel 0" message upon SSH login, there could be several reasons. Solutions vary as well, as desribed below.
For security reason, OpenSSH server, by default, binds X11 forwarding server to the local loopback address, and sets the hostname in DISPLAY
environment variable to localhost
. Under this setup, some X11 clients cannot handle X11 forwarding properly, which causes the reported error. To fix this problem, add the following line in /etc/ssh/sshd_config
file, which will let X11 forwarding server bind on the wild card address.
$ sudo vi /etc/ssh/sshd_config
X11Forwarding yes X11UseLocalhost no
Restart SSH server to activate the change:
$ sudo /etc/init.d/ssh restart
Or:
$ sudo systemctl restart ssh.service
Or:
$ sudo service sshd restart
The broken X11 forwarding error may also happen if the remote host where SSH server is running has IPv6 disabled. To fix the error in this case, open /etc/ssh/sshd_config
file, and uncomment AddressFamily all
(if any). Then add the following line. This will force SSH server to use IPv4 only, but not IPv6, so that SSH server complies with the IPv4-only server settings.
$ sudo vi /etc/ssh/sshd_config
AddressFamily inet
Again, restart SSH server to finalize the change.
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean