Resources · Port reference · port 5900
Port 5900 (VNC): what it is and how to secure it
VNC on port 5900 often uses an 8-character password and no encryption. Bind it to localhost and connect through an SSH tunnel.
Check command
sudo ss -tlnp | grep ':59[0-9][0-9] '
Copied.
Port 5900 is VNC, a remote screen. Display :0 uses 5900, :1 uses 5901, and so on. Classic VNC authentication only uses the first 8 characters of the password and many servers do not encrypt the session, so VNC should listen on localhost and be reached through SSH.
What port 5900 is for
TigerVNC, TightVNC, x11vnc, RealVNC and many hypervisors (Proxmox, QEMU/KVM consoles) use VNC to show a desktop or a virtual machine's screen remotely.
Why an open 5900 is dangerous
- Weak passwords. The classic VNC password scheme is limited to 8 characters, which makes guessing practical.
- No encryption in many setups, so the password and everything on screen cross the network in the clear.
- No password at all. Scans regularly find VNC servers with authentication turned off, showing live desktops and control panels.
Check yours
sudo ss -tlnp | grep ':59[0-9][0-9] '
Any 0.0.0.0:590x or [::]:590x line is public.
Fix it
Make the VNC server listen on loopback only. For TigerVNC, add this to ~/.vnc/config (or start it with -localhost yes):
localhost
For x11vnc, start it with -localhost. Restart the VNC server, then connect through SSH:
ssh -L 5901:127.0.0.1:5901 you@your-server
Point your VNC viewer at localhost:5901. The SSH tunnel encrypts everything, and only people who can SSH in can reach the screen.
For VM consoles (Proxmox, libvirt), keep the console behind the hypervisor's own web interface or a VPN rather than publishing the VNC port.
If several people need the desktop
An SSH tunnel per person works, but it means giving everyone SSH access. Two cleaner options:
- A VPN such as WireGuard or Tailscale. VNC listens only on the VPN address, and you add or remove people in one place.
- A web gateway such as Apache Guacamole behind HTTPS and single sign-on. People use a browser, and VNC itself stays on localhost.
Either way, give each person their own account so you can see who connected and remove access when someone leaves.
Common mistakes
- Opening 5900–5910 in the firewall for convenience.
- Running VNC as root, which gives a root desktop to anyone who gets in.
- Using the same password as the user account.
FAQ
Is VNC encrypted? Depends on the server and settings. Do not rely on it. The SSH tunnel makes the question irrelevant.
How do I get warned? PortGate's Server Guard alerts when a VNC port, or any new port, opens on a public address.