Networking
Risk: Critical

Port 5900 β€” VNC Remote Desktop (RFB Protocol)

Port 5900 is the default TCP listening port for Virtual Network Computing (VNC / RFB protocol) servers, including TightVNC, TigerVNC, RealVNC, and macOS Screen Sharing.

PORT NUMBER

5900

PROTOCOL

TCP

DEFAULT PROCESS

Xvnc, tigervnc, winvnc.exe

FIREWALL TARGET

5900/tcp

Instant Terminal Fixes for Port 5900

macOS & Linux Terminal
1. Check who is listening on port 5900:
sudo lsof -i :5900 || sudo ss -tulpn | grep ":5900 "
2. Kill process occupying port 5900 (EADDRINUSE fix):
vncserver -kill :0 || kill -9 $(lsof -t -i:5900)
3. UFW Firewall Allow rule:
sudo ufw deny 5900/tcp
Windows PowerShell (Admin)
1. Check listening port:
Get-NetTCPConnection -LocalPort 5900
2. Force kill process on port 5900:
Stop-Process -Name winvnc* -Force
3. Docker Port Forwarding Mapping:
docker run -d -p 5900:5900 dorowu/ubuntu-desktop-lxde-vnc

Common Error Encountered

VNC connection closed unexpectedly: RFB server not answering on port 5900.

Security Advisory & Hardening

Traditional VNC passwords are truncated to 8 characters and encryption is often nonexistent. Tunnel VNC over an SSH connection (ssh -L 5900:localhost:5900) instead of exposing port 5900.

Frequently Asked Questions

Port 5900 Questions & Answers

Common questions regarding default services, kill commands, and firewall configurations.

Port 5900 is commonly used for VNC Remote Desktop (RFB Protocol). Port 5900 is the default TCP listening port for Virtual Network Computing (VNC / RFB protocol) servers, including TightVNC, TigerVNC, RealVNC, and macOS Screen Sharing.