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=; 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 as display location, nothing works. After connection is established:

$ echo $DISPLAY


What do I do or understand wrong?

migrated from stackoverflow.com Jul 21 '11 at 19:53

This question came from our site for professional and enthusiast programmers.


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

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.


PuTTY X11 forwarding wires an SSH tunnel so that X connections at server's localhost:10 are piped to your PC.

  1. The remote X software connects to localhost:10 (localhost at the server)
  2. Server sshd listens to server's localhost:10 and forwards to putty through SSH tunnel
  3. PuTTY forwards X connection from server to localhost:0 (at your PC)

Normally X forwarding just works. Things to check:

  • Is PuTTY allowed to access local X server through :0?
  • Does putty know which X-server to forward to? Can PuTTY see DISPLAY=:0 environment variable?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.