Tightvnc logoTightvnc
Tightvnc logoTightvnc Download

Free remote desktop for Windows

Home / Guide / Securing Tightvnc with SSH Tunnels and VPN Connections

Securing Tightvnc with SSH Tunnels and VPN Connections

Classic VNC traffic is not encrypted by default. Here is how to wrap every session in an SSH tunnel or a VPN and harden the server itself.

Published 12 November 20267 min readBy the Tightvnc team
Securing Tightvnc with SSH Tunnels and VPN Connections

TightVNC is excellent at its core task: showing a remote desktop and carrying input back to it. Encryption of the session, however, is not part of the free edition. Passwords are protected during authentication, but the screen images and keystrokes that follow travel without encryption. On a trusted local network that is usually acceptable. Across the internet, it is not. This guide explains the risk plainly and shows how to wrap every session in an SSH tunnel or a VPN, then harden the server itself.

Understanding the Tightvnc Security Model

Classic VNC authentication uses a challenge-and-response exchange. The server sends a random challenge, the viewer encrypts it with a key derived from the password, and the server checks the result. The password itself never crosses the network in readable form, which is a sound design for its era.

The limitations lie elsewhere. First, only the first eight characters of a password are significant, which caps its strength. Second, once authentication succeeds, the session data, including everything displayed on screen and every key pressed, is transmitted without encryption. Anyone able to observe the traffic, for example on public Wi-Fi or a compromised network segment, could in principle reconstruct what you see and type.

The developer offers a paid Pro edition with built-in encrypted connections, which requires Pro on both ends. For users of the free edition, the established and highly effective answer is to carry the session inside an encrypted channel that already exists for that purpose.

Option One: An SSH Tunnel

Secure Shell, or SSH, is a mature protocol for encrypted remote access. Besides providing a command line, it can forward network ports through its encrypted connection. With port forwarding, the viewer connects to a port on your own computer, SSH encrypts the traffic and carries it to the remote network, and it emerges there to reach the VNC server.

What you need

  • An SSH server reachable from the internet at the remote site. This may be the TightVNC host itself, using the OpenSSH Server feature built into Windows, or a separate gateway machine such as a small Linux computer or a router that supports SSH.
  • An SSH client on your own computer. Windows includes the OpenSSH client, and graphical clients such as PuTTY are also widely used.
  • A firewall or router rule that exposes only the SSH port, typically TCP 22 or a custom value, rather than the VNC port.

Creating the tunnel from the command line

Open a terminal on your computer and run a command of the following form:

ssh -L 5901:localhost:5900 [email protected]

This instructs SSH to listen on local port 5901 and forward anything that arrives there to port 5900 on localhost, as seen from the SSH server. If the SSH server runs on the TightVNC host itself, localhost refers to that host. If it runs on a separate gateway, replace localhost with the private address of the TightVNC host:

ssh -L 5901:192.168.1.24:5900 [email protected]

Keep the SSH session open, then start TightVNC Viewer and connect to localhost::5901. The viewer believes it is talking to a local service; in reality, every byte is encrypted on its way to the remote site.

Creating the tunnel with PuTTY

  1. Enter the SSH server’s host name in the Session category.
  2. Open Connection > SSH > Tunnels.
  3. Enter 5901 as the source port and localhost:5900 or 192.168.1.24:5900 as the destination.
  4. Add the forward, return to the Session category, save the profile and open the connection.
  5. Sign in, then connect the viewer to localhost::5901.

Use keys rather than passwords

SSH supports public-key authentication, which is dramatically stronger than any password. Generate a key pair on your computer with ssh-keygen, copy the public key to the server’s authorised keys file and then disable password sign-in on the SSH server. An attacker scanning the SSH port is then faced with a cryptographic key rather than a guessable secret.

Option Two: A VPN

A virtual private network connects your device to the remote network as though it were plugged in locally. Once the VPN is active, you connect the viewer to the host’s private address, such as 192.168.1.24, and the VPN encrypts everything in transit.

A VPN is often the better choice when several people need access to several computers, because it secures all remote traffic at once rather than one port at a time. Modern protocols such as WireGuard are lightweight and fast, and many business and consumer routers include a VPN server. OpenVPN and IPsec remain common in corporate environments.

Whichever method you choose, the principle is the same: expose a service designed for the internet, such as SSH or a VPN, and keep the VNC port itself private.

Locking the Server to the Tunnel

An encrypted channel is most effective when it is the only way in. TightVNC Server can be configured to accept connections solely from the loopback address, which is where SSH-forwarded traffic arrives when the SSH server runs on the same machine.

  1. Open the server configuration and select the Access Control tab.
  2. Enable the option to allow loopback connections.
  3. Enable the option to accept only loopback connections.
  4. Apply the change and confirm that a direct connection from another computer is now refused, while a tunnelled connection succeeds.

When a VPN is used instead, restrict access control rules to the VPN’s address range. The server configuration guide explains rule ordering in detail.

Hardening Tightvnc Itself

Encryption protects the session in transit, but the server’s own configuration still matters. Apply the following measures on every host.

  • Strong primary password. Use the full eight significant characters with a mixture of character types, and make it unique.
  • Distinct view-only password, or none at all if view-only access is not required.
  • Administrative password to stop local users weakening the settings.
  • Query the local user for incoming connections on personal computers, so nobody connects unnoticed.
  • Lock the workstation when the last viewer disconnects.
  • Disable the web access port if you do not use it.
  • Keep the software updated, because updates address defects that could otherwise be exploited.

Monitoring and Auditing Access

Security is not only about prevention but also about noticing when something is wrong. Enable logging in the server’s administration settings and review the logs from time to time. Repeated authentication failures indicate that someone is trying passwords. On the SSH side, the server’s authentication log records every attempt, and tools that temporarily block addresses after repeated failures add a further safeguard.

For organisations, maintain a simple record of who has remote access to which computers, and remove access promptly when people change roles or leave. Rotate passwords on a schedule, and immediately after any suspected disclosure.

Common Mistakes to Avoid

  • Forwarding port 5900 directly on the router “just for now” and forgetting to remove it.
  • Creating an SSH tunnel but leaving the VNC port open to all addresses, so the tunnel can simply be bypassed.
  • Reusing the same VNC password on every computer in an organisation.
  • Storing passwords inside saved connection files that are shared on network drives.
  • Using public Wi-Fi for remote sessions without a tunnel or VPN.

Making Tunnels Convenient

A security measure that is awkward to use tends to be skipped. Fortunately, SSH tunnels can be made almost effortless. With the OpenSSH client, add an entry to the configuration file in your user profile so that a single short command opens the tunnel with all the correct options:

Host office-vnc
    HostName office-gw.example.net
    User admin
    IdentityFile ~/.ssh/id_ed25519
    LocalForward 5901 192.168.1.24:5900

Running ssh office-vnc then establishes the tunnel, and the viewer connects to localhost::5901 as before. In PuTTY, a saved session achieves the same result. You can also create a desktop shortcut or a small script that opens the tunnel and then launches the viewer, so the protected route becomes the easiest route. For several remote hosts, assign each a different local port, such as 5901, 5902 and 5903, and record which port belongs to which computer.

Next Steps with Tightvnc

The free edition of TightVNC, wrapped in an SSH tunnel or a VPN and configured with care, provides robust protection for remote work. The encryption is handled by proven, widely audited tools, and the server is reachable only through them. For the network groundwork, revisit the ports and firewall guide, and if your hosts must be available around the clock, the service mode guide explains how to keep them reachable and secure at the same time.