Port reference › Remote access

Port 5900 · VNC

Remote screen control

TCP Remote access Exposure risk: High

What is port 5900 used for?

VNC screen sharing. Display numbers map to 5900, 5901, 5902… macOS Screen Sharing also uses this port.

Registered port (1024-49151): the range used by ordinary applications.

Security notes

Classic VNC has weak encryption and short passwords. Do not expose it; connect through an SSH tunnel (ssh -L 5901:localhost:5901) or VPN.

Allow port 5900 through the firewall

This port is risky to expose, so the commands below allow only the IPs you specify.

# Replace 203.0.113.10/32 with the IP or network you want to allow
sudo ufw allow from 203.0.113.10/32 to any port 5900 proto tcp
sudo ufw status

Check whether port 5900 is open

sudo ss -tlpn | grep ':5900 '

Other remote access ports

22 SSH 2222 SSH (alternate port) 23 Telnet 3389 RDP 5985 WinRM (HTTP) 5986 WinRM (HTTPS)