How to access VNCServer using VNCViewer and SSH/PuTTY to access my Raspberry Pi over port 22 (instead of VNCServer’s port 5900). This requires that VNC Server was setup on the Raspberry Pi, VNC Viewer was installed on your local machine and port forwarding was previously sertup.

Download PuTTY:
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Launch PuTTY

Enter a Host Name (Your IP address or Domain Name)

Click on SSH then X11 and Enable X11 Forwarding

Click on Session and Save

Connect to the server.

Start your VNCServer:
“vncserver”

Note the ‘hostname:# (username)’

Then kill that VNCServer:
“vncserver -kill :#”
Yours is probably:
vncserver -kill :1″

CD into the .VNC directory:
“CD ~/.vnc/”

Create an ‘xstartup’ text file:
“sudo nano xtsartup’

Paste this in:
“# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc”

Restart VNC Server:
“vncserver”

Go back to PuTTY

Load your saved server settings

Go to SSH-Tunnels

Source Port: “5900”
Destination: “hostname:590+server number”
Mine was “gatewaypi51:5901”

Click Add

Click on Session and Save

Connect to your server

Open up VNCViewer

Have VNCVierwer access server “localhost”

Done!

Further Documentation:
https://crl.ucsd.edu/handbook/vnc/

BOM:

Putty (for SSH into the RasbperryPi): https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Raspberry Pi 3: http://amzn.to/2vzMNTs

32 GB Micro SD Card: http://amzn.to/2eGMQJf

2.5 amp USB-Micro Charger: http://amzn.to/2eGv9cZ

Raspberry Pi 3 Case: http://amzn.to/2gVxW2J

10/100/1000 USB Ethernet Adapter: http://amzn.to/2eGZx6P

source