Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to SSH and Linux so please don't laugh if this is a simple question. I've looked and haven't really found anything using Google that does exactly what I want it to do.


Home LAN

Router - Listening for Port 443 - Redirects anything on port 443 to Port 22 on "sshserver"

Ubuntu Server (Behind Router) - name = sshserver - openSSH installed. Ip address - SSH listening on port 22 - System-Preferences-Remote Desktop - Enable - Password - (Uncheck confirm each connection to this computer)

Outside my house

Ubuntu Desktop (name = workstation) with Putty installed. Obviously my IP address is dependant on where ever I am.

What I Can do now

I can ssh into my "sshserver" no problems using "Workstation". Everything is working great. I am connecting my Ubuntu "workstation" to "sshserver" using Putty.

What I have tried

I am under the understanding that when you check off "remote desktop" in Ubuntu, VNC will run on port 5900. Because I know the session screen page works (I can always successfully log in with SSH) I just want to just edit the Putty - ssh - Tunnel section.

On this scren I have tried entering: source port: 5900 destination port: localhost:5092

The reason why I have done this is I have the intention of using Applications - Internet "remote desktop viewer" application. In it I tell it I want an VNC type connection and that I want to connect on "localhost:5092".

This fails miserably. I guess I am just not understanding exactly how the tunneling happens and how to correct this issue. If anyone could help me understand how this works using the tools I have listed I would be really thankful!

THanks in advance.

share|improve this question
up vote 4 down vote accepted

Enter in all the connection information on the main putty screen. Sounds like you will be using port 443 instead of 22 to connect from the outside. Then go to the Tunnels section and put in 5092 for the Source port. Put in localhost:5900 for the destination. Leave the radio buttons to Local and Auto. Click Add so it shows up in the list and then open up the connection

putty port forward config

When you open up the connection, you will have access to "localhost:5900" from the perspective of the server. You can access it from your local port 5092.

To connect to the server using vnc, plug in localhost:5092 for the host. enter image description here

share|improve this answer
Thank you so much! Pictures are worth a thousand words. – Jared Heinrichs Jan 31 '11 at 22:21
This solved the issue. – Jared Heinrichs Jan 31 '11 at 22:22
@Jared Heinrichs Awesome, glad I could help! Make sure you secure your ssh server from brute force attacks with denyhosts or fail2ban. I got hacked once... its not fun. – James T Jan 31 '11 at 22:49
Thanks for the heads up. I will look into those items. Thanks again, makes learning this stuff so much easier when everyone helps each other out :) – Jared Heinrichs Feb 1 '11 at 14:30

Other way around. The local port is what port you connect to on your side, the Destination is where that connection goes on the server side. So if you want to point vncclient to "localhost:5902" and have that come out on the server side as "localhost:5900", you need to make Local Port be "5902" and Destination be "localhost:5900"

The Local Port is always on the ssh client's localhost. The Destination can be anywhere, including the ssh server's localhost.

share|improve this answer
Thanks for the suggestion. Unfortunately it didn't seem to help. Again I can logon using Putty to the "sshserver". When I open "Remote Desktop Viewer" I click "connect" - "protocol = vnc" - "Host = 5902" and then hit connect. Comes back with error: Connection to host is closed. Seems to be a generic error message. – Jared Heinrichs Jan 31 '11 at 20:37
What is the output of 'netstat -pltn' on both machines, after you've connected with putty? – Steven Jan 31 '11 at 22:08

I used to run ssh -L 5900:localhost:5900 me@home and then start vncview localhost. My home desktop was a debian running GNOME and vino. Worked like a charm.

share|improve this answer
ssh -L 5900:localhost:5900 I am never asked for my password. – Jared Heinrichs Jan 31 '11 at 20:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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