Friday, September 01, 2006

x11 forwarding and localhost

It's sometimes the little things that get me. Like putting a decimal point in the wrong spot, and then explaining to the bank why they owe me $700 instead of only $7. X11 forwarding is one of those things. I use X11 on my windows box for cygwin and remote *nix apps. I write in java a lot, so I port my apps over to a local beowulf cluster and fire up some slaves to cary out my world domination plans. Some of my apps use GUIs, and being able to display them on my local machine through the aether via ssh and x11 forwarding is pretty cool.

But there was this one box that absolutely would not forward X11. The server was configured to allow X11 forwarding, my client was set to allow X11 forwarding, ssh was sending the right stuff over, but there was still a disconnect. I could send over an xterm if I explicitly set the display to my local machine, open up the firewall, and add the remote box to xauth, but that's pretty lame and it also isn't secure. When I ssh in, $DISPLAY was being set to localhost:12.0 , which makes sense. So the only thing left to check was the resolution of localhost. Turns out that some bonehead put an entry in the hosts file to set localhost to the host's external IP instead of 127.0.0.1 - grr! Lesson learned.

So if you're at your wits end googling for "xterm Xt error: Can't open display: ", or why x11 won't play nice with ssh, or how to configure ssh to allow x11 forwarding, check your hosts file. It might save you a bit of sanity.

1 Comments:

Anonymous Anonymous said...

Really Useful. Thanks.
regards
Sachin

7:24 AM  

Post a Comment

<< Home