First of all in .ssh/config, create an entry:
host shortnamevnc
hostname the_url_of_server
localforward 12345 localhost:5901
identityfile ~/.ssh/id_rsa
User change_to_your_username
host shortname
hostname the_url_of_server
identityfile ~/.ssh/id_rsa
User change_to_your_username
The following commands need to be run everytime the server gets rebooted.
ssh shortname
#On ssh server run vncserver
vncserver -localhost -geometry 1280x800
#Enter some password for vnc, and find out what port the vncserver was started.
#This info is output at the end after running the command. Look for :1, or :2,
#call this display number.
#The number to put instead of 5901 in the .ssh/config file is (5900+display number).
First create the tunnel from the server to your machine
ssh -N shortnamevnc &
This needs to be done everytime the ssh connection gets reset.
For vnc, then run:
vncviewer localhost:12345
or
remmina