[Read This Fine Material] from Joshua Hoblitt

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


Much to my surprise, I encountered this error message when connecting to a RHEL6.3 server in order to remote display a RAID controller management app.

jhoblitt@foo ~ $ ssh -X foo2
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
Warning: No xauth data; using fake authentication data for X11 forwarding.
X11 forwarding request failed on channel 0

It seems that an update to OpenSSH changed the semantics of X11 forwarding. A bit of googling turned up the answer in this thread:


The fix is to add this line to your /etc/ssh/sshd_config:

X11UseLocalhost no

In previous version just X11Forwarding yes was needed but it seems that both directives are now required.

I’m not sure when this change was introduced but it’s definitely present in this version of sshd:

[jhoblitt@pfoo2 ~]$ ssh -V
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
[jhoblitt@foo2 ~]$ rpm -qa | grep openssh


  1. Thanks, that fixed my CentOS 6.4 server. My other servers are older versions of CentOS so I had not run into this one before.

  2. @stanlarson I’m glad to hear that resolved it for you as well. @petdance reported that this fix didn’t work for him so I’m wondering if there are multiple root causes to that error message.

  3. I did the X11UseLocalhost thing, but to no avail. Turned out I needed to install xauth on my CentOS VM, and I discovered that by doing ssh -v, where I got the message “Remote: No xauth program; cannot forward with spoofing.”. So that’s something else to try.

  4. I ran into this problem as well on CentOS 6.4, but the issue was that xauth was not even installed.

    $ yum install xauth

    Fixed it. No doubt this was the result of doing the text based install, but I thought I’d mention it in case it helps anyone else. (It’s been so long since I’ve had an X11 forwarding problem that I forgot about xauth…)

  5. @markevans @ kitfenderson-peters Did installing `xauth` fix it without having to set `X11UseLocalhost`?

  6. All I did was change the IP address on my SuSE 12.3 VM and this! This fixed it even though prior to the change of IP it worked flawlessly. Odd.

  7. Thanks for the tip, kitfenderson-peters. This was giving us problems with some users who were using ssh under git for remote operations. Installing xauth did the job nicely.

  8. Pingback: How to fix “X11 forwarding request failed on channel 0″ | Webové stránky Jana Faixe

Leave a Reply