When trying to connect via ssh to a CentOS 6 server to invoke a GTK+ application, I received this message.
$ ssh email@example.com -X
X11 forwarding request failed on channel 0
Last login: Thu Apr 12 08:15:43 2012 from 192.168.201.151
After double check on my client Arch linux the
/etc/ssh/ssh_config file and corroborate that “ForwardX11 yes” was uncommented, began to search the web for a bug in CentOS’s openssh.
Firsts impressions and answers said that it was my openssh client’s fault… then I installed putty, enabled X11 Forwarding and tried again. Now it connected without saying nothing but when I tried to open the graphical application, it said this
Unable to initialize graphical environment. Most likely cause of failure is that the tool was not run using a graphical environment. Please either start your graphical user interface or set your DISPLAY variable. Caught exception: could not open display
So it wasn’t openssh’s fault as someone said. Doing a bit more of research gave me the correct answer. Finally I found a bug on CentOS 5 bugzilla where is explained in detail.
My problem was that
xorg-x11-xauth wasn’t installed on my system (I did a minimal instalation). By installing xorg-x11-xauth and rebooting the server (until I did, it did not work), it connects without problems by typing
$ ssh root@IP_ADDRESS -Y
I tried with the -X parameter instead -Y, but it gave me some problems. With -Y it works like a charm!