VNC

VNC port guide: remote desktop access on port 5900

Understand how VNC and RFB use TCP 5900, why display numbers change the port, how to test connectivity, and why direct public exposure needs strong controls.

Default port
5900
Protocol
TCP
Primary use
Remote desktop access

What is the VNC port?

VNC, or Virtual Network Computing, is a remote desktop system built around the RFB protocol. A VNC server commonly listens on TCP port 5900 for display :0. Additional displays usually increment the port number, so display :1 often listens on 5901 and display :2 often listens on 5902.

  • 5900 is the default VNC port

    Most VNC viewers expect a server on TCP 5900 unless the user specifies another display number, custom port, gateway, or tunnel.

  • VNC should usually stay private

    VNC can expose a full graphical desktop. Use VPN, SSH tunneling, private networks, or source allowlists instead of leaving it broadly reachable from the internet.

How VNC works

VNC lets a viewer control a remote graphical desktop over the network. The viewer connects to a VNC server, negotiates the RFB protocol, authenticates, and then exchanges screen updates, keyboard input, mouse input, clipboard data, and sometimes file-transfer features depending on the server implementation.

VNC is used for Linux desktops, macOS screen sharing, embedded systems, lab machines, jump hosts, and remote support. Different implementations such as TigerVNC, TightVNC, RealVNC, UltraVNC, x11vnc, and noVNC can use different defaults and security options, so always verify the actual listener and configuration.

VNC port 5900 and display numbers

The usual VNC port is TCP 5900 for display :0. Traditional VNC display notation adds the display number to 5900, which means :1 maps to 5901, :2 maps to 5902, and so on. Some viewers let users type either host:5901 or host:1 depending on the client interface.

Do not assume every VNC server follows the display convention. Many servers can be configured with a custom TCP port, a reverse connection mode, a web proxy, or an SSH tunnel. Use server settings, firewall rules, and listener checks to confirm the real port.

VNC vs RDP and SSH

VNC, RDP, and SSH solve different remote access problems. VNC shares or creates a graphical desktop using the RFB protocol, usually on port 5900. RDP is Microsoft Remote Desktop and commonly uses port 3389. SSH is a secure shell protocol on port 22 and is often used to create tunnels for VNC.

For Windows remote desktop workflows, RDP is usually more integrated. For cross-platform graphical access, VNC is flexible. For secure administration, SSH is often the safer outer access path, especially when VNC itself is bound to localhost and reached through an SSH tunnel.

When VNC should be open

Open VNC only when a trusted user, support tool, automation workflow, lab network, or private management path needs graphical remote desktop access. Common cases include remote Linux desktop support, kiosk maintenance, embedded device management, and private lab access.

Avoid opening VNC to the entire internet. A public VNC port can attract brute-force attempts, weak-password attacks, desktop takeover attempts, and scanning for older servers. If remote access is required, place VNC behind a VPN, SSH tunnel, zero-trust access layer, bastion, or source-IP allowlist.

How to open VNC on a firewall or router

First confirm which VNC server is running, which interface it listens on, and which display or TCP port it uses. Then allow the exact port only from trusted source networks. For display :0 that is usually TCP 5900; for display :1 it is often TCP 5901.

On a router, forward the external port to the internal VNC host only if you have a strong reason and a narrow source policy. On servers, align the host firewall, cloud security group, VPN policy, and VNC server bind address so the service is reachable only through the intended path.

  • Service layer: the VNC server must be running and listening on the intended TCP port.
  • Display mapping: confirm whether the client expects a display number such as :1 or a raw TCP port such as 5901.
  • Network layer: host firewall, router forwarding, cloud firewall, VPN, and allowlists must match the access path.
  • Security layer: require strong authentication, encryption or tunneling, source restrictions, and session logging where available.

How to test VNC port connectivity

Start with an external port check against the public hostname or IP address and port 5900, or the custom VNC port you configured. If the port is open, a remote client can reach a TCP listener. Then test with a real VNC viewer to confirm protocol negotiation, authentication, desktop access, and screen updates.

On the server, check listeners with ss, netstat, lsof, PowerShell, or the VNC server status page. If VNC is tunneled over SSH, test the SSH connection first, then confirm the local forwarded port and viewer target.

Test port 5900 for VNC

Common VNC troubleshooting cases

If the VNC port is closed, the server may be stopped, bound only to localhost, listening on another display, or blocked by the host firewall. If the check times out, a router, cloud firewall, VPN policy, ISP filter, or source-IP restriction may be dropping packets before they reach the host.

If the port is open but the viewer cannot connect, check the display number, protocol version, password policy, encryption requirement, server-side access rules, desktop session state, and whether the VNC server allows connections from the viewer network. Some servers reject clients when no desktop session is available.

Security checklist for VNC

Do not rely on a VNC password alone for internet-facing access. Prefer VPN, SSH tunnels, private networks, or zero-trust access, and bind VNC to localhost when tunneling. Use strong unique credentials, disable unused accounts, and keep the VNC server patched.

Enable encryption when the server and viewer support it, restrict source IPs, monitor failed logins, and review whether clipboard, file transfer, or unattended access should be disabled. Treat VNC as full desktop access, not as a simple status endpoint.

Frequently asked questions

What port does VNC use?

VNC commonly uses TCP port 5900 for display :0. Additional displays often increment the port, so :1 uses 5901 and :2 uses 5902 unless the server is configured differently.

Why does VNC use 5901 instead of 5900?

Traditional VNC display numbers are added to 5900. Display :1 maps to TCP 5901, while display :0 maps to TCP 5900. Some servers also use custom ports that do not follow this convention.

Is it safe to expose VNC to the internet?

Direct public VNC exposure is risky because it can provide full desktop access and is frequently scanned. Use a VPN, SSH tunnel, private network, source allowlist, or zero-trust access layer whenever possible.

Why is the VNC port open but the viewer cannot connect?

The TCP listener may be reachable while the VNC protocol, display number, password, encryption setting, access rule, or desktop session state blocks the viewer. Test with the actual VNC client and inspect server logs.

Should I use VNC or RDP?

Use RDP for native Windows Remote Desktop workflows when available. Use VNC for cross-platform graphical access, Linux desktops, embedded systems, or environments where an RFB-based viewer is required.