I am trying to use Putty and VNC Viewer on the client to connect to a Ubuntu host which has X11Forwarding yes and X11DisplayOffset 10 set in the SSHD configuration. I have enabled X11 Forwarding and specified the X Display Location of localhost:10.0 in the Putty client. How does Putty know to use the RealVNC viewer? When I try launching something, say Firefox I get the following which is probably expected since the VNC client is not linked or I do not know what to specify in the VNC client. Do I just need to forward 5900 instead of enabling X11?

$ Error: cannot open display: localhost:10.0
[1]+  Exit 1                  firefox

Have also tried port forwarding per screen-shot below.

Putty screen-shot

2 Answers 2


X11 forwarding has nothing to do with getting VNC access. The first step is to make sure you are running the VNC server. In ubuntu, the built-in server is Desktop Sharing Preferences. You will need to select the check box Allow others to view your desktop. You probably also want to select the control option as well.

Once that is running, you will need to get access to it. To do so, run Putty on the client, and set up the port-forward like the screenshot shows. This will allow your client to have access to the correct port on the server.

Finally, on the client run VNC Viewer with the server option localhost.

Thus the final setup is:

 ______________________________________             _________
/          Client machine              \           / Network
| VNC Viewer --localhost:5900--> Putty --server:22-->
\______________________________________/           \_________
________       ____________________________________________
Network \     /              Server Machine                \
 --server:22 --> ssh server --localhost:5900--> VNC server |
________/     \____________________________________________/

Whenever I do this I use Putty to forward port 5900 to the local machine in my case usually port 5900 and then just point RealVNC at localhost.

  • I tried that by specifying Dynamic and 5900 as the source port. Then opened RealVNC and used localhost. Didn't get an error but it just disappeared into the background (process still running)?
    – Astron
    Nov 9, 2011 at 20:28
  • I use 'Local' instead of dynamic, 5900 as source port, and target-host:5900 as destination.
    – Phil
    Nov 10, 2011 at 11:55
  • Do you have Enable X11 Forwarding checked and a X display location specified in Putty? If so what do you use for the latter?
    – Astron
    Nov 10, 2011 at 14:06
  • Nope, I don't have anything to do with X11 forwarding enabled. I leave everything on the defaults apart from the single port forward. Whilst it is possible to run an X server on windows I have found VNC to be a better solution for remote access.
    – Phil
    Nov 10, 2011 at 15:26
  • Does your setup look like the screen-shot in the question?
    – Astron
    Nov 11, 2011 at 19:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .