HTTPfy

Port 5900 (VNC)

Virtual Network Computing / RFB remote desktop. Display :0 is 5900, :1 is 5901 and so on. macOS Screen Sharing uses it too.

Registered (user) port, 1024-49151 TCP Remote access Expose only to trusted sources

What port 5900 is used for

Virtual Network Computing / RFB remote desktop. Display :0 is 5900, :1 is 5901 and so on. macOS Screen Sharing uses it too.

Security: should port 5900 be open?

Expose only to trusted sources. Do not expose VNC. Many servers use weak 8-character passwords or none, and scanners regularly find open desktops, including industrial HMIs. Tunnel it over SSH or a VPN.

IANA assignment

Service nameProtoDescriptionAssigneeReference
rfb TCP Remote Framebuffer Tristan Richardson RFC 6143
rfb UDP Remote Framebuffer Tristan Richardson RFC 6143

Registry dates for this port: registered 2006-03.

Check what is listening on port 5900

Linux: is anything listening on TCP 5900?
sudo ss -tlnp 'sport = :5900'
Linux / macOS: which process owns the port
sudo lsof -nP -i :5900
Older Linux / BSD (net-tools)
sudo netstat -tlnp | grep ':5900 '
Windows (Command Prompt)
netstat -ano | findstr :5900
Windows (PowerShell)
Get-NetTCPConnection -LocalPort 5900 -State Listen | Select LocalAddress,OwningProcess

Test it from outside

From another machine
nc -vz -w 5 HOST 5900
From Windows
Test-NetConnection HOST -Port 5900

Allow only trusted sources on port 5900 in the firewall

Replace 203.0.113.10 with the address or network you trust. With ufw, make sure the default incoming policy is deny.

ufw (one trusted source)
sudo ufw allow from 203.0.113.10 to any port 5900 proto tcp
iptables
sudo iptables -A INPUT -p tcp --dport 5900 -s 203.0.113.10 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 5900 -j DROP
nftables
sudo nft add rule inet filter input ip saddr 203.0.113.10 tcp dport 5900 accept
sudo nft add rule inet filter input tcp dport 5900 drop
Windows Firewall
New-NetFirewallRule -DisplayName 'TCP 5900 trusted' -Direction Inbound -Protocol TCP -LocalPort 5900 -RemoteAddress 203.0.113.10 -Action Allow

Related ports

All port numbers · Open port checker
Assignment data: IANA port number registry (public domain), retrieved 2026-11-10.