I had a few issues with X11 forwarding over SSH on one of my CentOS hosts. After a bit of fiddling, I discovered that there were a couple of things I hadn’t taken into account.
I’d set my putty session up to allow X11 fowarding, and set the X display location to “localhost”. On the server, I installed xclock and its dependencies for testing, and set the following in /etc/ssh/sshd_config:
X11Forwarding yes X11DisplayOffset 10 X11UseLocalhost yes
I restarted sshd, however this still wasn’t working.
In short, I was missing two things:
1) xauth wasn’t installed. This is required!
2) I wasn’t allowing connections to localhost in my iptables config. This was fixed in my ruleset with:
iptables -A INPUT -i lo -j ACCEPT
sshd was restarted after installing xauth and adding the firewall rule and it now works a treat!