X11 Forwarding with PuTTY – A Comprehensive Guide

puttyxorg

I think I do not understand what X11 forwarding setting in PuTTY does…

When SSH->X11 setting is unticked, but I specify the remote command "export DISPLAY=192.168.32.106:0.0; xterm" under SSH setting, then I can get remote windows displayed on my PC.

If I remove remote command and tick SSH->X11 checkbox and specify 192.168.32.106:0.0 as display location, nothing works.
After connection is established:

$ echo $DISPLAY

localhost:10.168

What do I do or understand wrong?

Best Answer

I should not be necessary to set the DISPLAY environment variable at all, provided the SSH server has defined X11DisplayOffset. Since you're seeing localhost:10.168 (which is bogus) it appears that the SSH server has 10 for that setting, which is a typical default.

Simply tick the SSH > X11 box and establish a connection. Verify the $DISPLAY value on the remote machine, and it should look like this:

$ echo $DISPLAY
localhost:10.0

The display is localhost from the remote machine's point of view because SSH is intercepting that display and forwarding it back over your tunnel to your local machine. Assuming you have an X server running on your local machine, launch an xterm or something on the remote machine and it should pop right up on your local display.