SSH

VNC using an SSH Tunnel

To start the VNC server type:

$ vncserver

user$ vncserver
xauth:  file /home/user/.Xauthority does not exist

New 'example.com:1 (user)' desktop is example.com:1

Creating default startup script /home/user/.vnc/xstartup
Creating default config /home/user/.vnc/config
Starting applications specified in /home/user/.vnc/xstartup
Log file is /home/user/.vnc/example.com:1.log

Your VNC port number will be 5900+<number_after_the_colon>.
In this case your port would be 5901.

To create the SSH Tunnel type:

$ ssh -L <local_port>:localhost:<remote_port> -f -N -C user@example.com

In this case it would be:

$ ssh -L <port_of_your_choosing>:localhost:5901 -f -N -C user@example.com

Using PuTTY

First start a new SSH connection to your server host and log in.

Attach:putty_change_settings.png

Then, left click on the program icon in the top bar -> Change Settings -> Connection -> SSH -> Tunnels.

Attach:putty_ssh_tunnels.png

Source port: <local_port>
Destination: localhost:<remote_port> (localhost here represents the remote host)
Keep the Local and Auto radio buttons selected and click on Add.

Connect to localhost:<local_port> using a VNC Client.

It may still show the warning saying "Uncrypted Connection" in the VNC Client when connecting to localhost:<port> since it isn't aware of the SSH Tunnel.