How to fix “X11 forwarding request failed on channel 0″

https://joshua.hoblitt.com/rtfm/2013/04/how_to_fix_x11_forwarding_request_failed_on_channel_0/

I’m using Ubuntu 12.04. The X11 forwarding is enabled in /etc/ssh/sshd_config (X11Forwarding yes).

As I stared more verbose mode:
ssh -vvv -X remotehost

I received following error:

X11 forwarding request failed on channel 0

The solution is to add following to configuration file /etc/ssh/sshd_config:

X11UseLocalhost no

Do not forget to restart ssh daemon:
service ssh restart