It’s very easy to create a tunnel with SSH to access a Remote VNC Server. It can be done with this command:
-L 5900:localhost:5900 -N -f -l <user> <host>
- -L 5900:localhost:5900 Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side. If you have a VNC server running on the client computer you will need to use an alternative port like 5901.
- -N Do not execute a remote command. This is useful for just forwarding ports.
- -f Makes ssh run as a background task after you have entered in your log-on password.
- -l The user you log onto the remote machine as.
Once the tunnel is created successfully you just need to use whatever VNC Client you choose and connect to host localhost:<local port>.
You now have secure access to your VNC server. You can use this to connect any other applications through an SSH Tunnel, just modify as necessary.
You can also create tunnels using PuTTY in Windows. You just need to expand Connection and then SSH under the Categories. Select Tunnels and add a source port and destination. The following picture shows how. You then just need to create the SSH connection as normal.