How to securely connect to any computer anywhere in the world with VNC and port forwarding via SSH connection.

Use the port forwarding technique to pass traffic through an SSH connection because by default the firewall on the remote network will not allow direct connection to port 5900, which is the port number that VNC listens by default and for security reasons, it is recommended not giving access to this port on the internet.

Prerequisites
Before trying this tutorial, you should have the following:
  • Two devices with Windows 10 and Ultra VNC installed.
  • The PC you want to connect to must have ultra VNC server installed, have a password setup on it and you must know the VNC password.
  • Know the host name or IP address of the computer that has the VNC server and the port number that the VNC server listens on.
  • An SSH server on the local network to which you want to connect.
  • Know the host name or IP address of the router that has the SSH server and the port number that the SSH server listens on.
  • Have plink or putty installed on the computer you will be using the VNC client.

This blog post provides information you need to access your computer from anywhere with VNC and SSH. Please review all requirements before proceed with this guide. If you have a personal question that you would like me to answer, please use the contact form.

Step 1: Configuring an SSH tunnel using Plink

Open command prompt and type: plink -ssh -i ssh-private-key -L Local-Port-Forward-on-vnc-client:local-ip-address-of-the-remote-pc:listening-VNC-port-on-the-remote-computer -P port-of-ssh-server user@ssh-server-ip-address-or-ssh-server-hostname
plink -ssh -i amazonkey.ppk -L 5977:172.16.40.77:5900 -P 31587 root@htopskills.com

When you finish writing the information, press Enter.

If this is not the first time you log on to this remote computer and you see a different key fingerprint, there’s a big chance it’s a man in the middle attack SSH.

If everything is correct, press y to store the key in cache and when you see on the screen “press return to begin session”, press enter

Step 2: Connect to remote computer with ultra VNC

Now, you are connected to the SSH server and a local port to connect to the remote PC is listening on port 5977 on your windows computer.

Go to search, type vnc and select UltraVNC Viewer to open the VNC client.

Type localhost or 127.0.0.1 and the local port you just setup for the vnc.

Click connect to access the remote computer who is running the VNC server.

In the VNC authentication window, enter the password of the remote VNC server and click Log On.