PortScan › Port guide › Port 5900
Port 5900 (VNC): Password-Free Remote Screens Are More Common Than You Think
Port 5900 is VNC screen sharing. No password, or legacy auth that uses only 8 characters, leaves many VNC screens exposed online. Safer setups like SSH tunnels.
What is port 5900?
VNC is a remote desktop method that lets you see and control another computer's screen as-is. Port 5900 is the first display (display :0) and 5901 the second. It is common on Mac Screen Sharing, Raspberry Pis and industrial control PCs.
When it is normally open
- Remote support inside an organization
- Remote control of a Raspberry Pi or Linux desktop
Risks if it is open
No or weak authentication
Some VNC servers can be configured to show the screen with no password, and many implementations of traditional VNC authentication use only the first 8 characters of the password. Security researchers have repeatedly found unauthenticated VNC screens on the internet — including factory control panels and hospital systems.
No encryption
Many implementations of the basic RFB protocol do not encrypt the screen contents or keystrokes.
Security checklist
- Do not open 5900 to the internet; use an SSH tunnel:
ssh -L 5900:127.0.0.1:5900 user@host, then connect your VNC client to local port 5900. - Configure the VNC server to accept connections only on
localhost(TigerVNC-localhost). - Using it only inside a VPN (Tailscale, etc.) is also a good option.
How to check whether port 5900 is open
From outside (is it exposed to the internet?)
Whether your server or home router accepts port 5900 from the internet can only be confirmed by connecting from outside. A check from inside the same network bypasses the router's firewall and gives a different answer.
PortScan opens a real TCP connection from the Cloudflare edge and reports Open, Closed or Filtered. Members can scan every port on their own IP for free and other targets free once a day.
Check port 5900On the server (what is listening?)
Windows (PowerShell):
netstat -ano | findstr ":5900 "
Get-NetTCPConnection -LocalPort 5900 -State Listen | Select LocalAddress,OwningProcess
Linux:
sudo ss -tlnp | grep ':5900 '
If it listens on 0.0.0.0 or [::] it is open on every network; 127.0.0.1 means only that machine can connect. To test port 5900 on a server from another computer, use Test-NetConnection server-address -Port 5900 on Windows or nc -vz server-address 5900 on Linux and macOS.
How to close or restrict port 5900
The best fix is to turn the service off or make it listen only on 127.0.0.1 (see the checklist above). If you need the service but must keep it off the internet, use a firewall.
Windows Firewall
# Administrator PowerShell
New-NetFirewallRule -DisplayName "Block TCP 5900" -Direction Inbound -Protocol TCP -LocalPort 5900 -Action Block
# To allow a single IP instead (block rules take precedence, so use this instead of the rule above)
New-NetFirewallRule -DisplayName "Allow TCP 5900 from office" -Direction Inbound -Protocol TCP -LocalPort 5900 -RemoteAddress 203.0.113.10 -Action Allow
Linux (ufw)
sudo ufw deny 5900/tcp
# Allow a single IP only
sudo ufw allow from 203.0.113.10 to any port 5900 proto tcp
On a cloud server, also check port 5900 in the security group (inbound rules), which is separate from the OS firewall. For services running in Docker, the rules Docker creates can bypass ufw, so binding the port to localhost with -p 127.0.0.1:5900:5900 is the reliable option.
Router
At home or in a small office, open the router's admin page and check whether port 5900 is in the port forwarding list, whether DMZ is enabled, and whether any program opened ports by itself through UPnP. If any of the three applies, port 5900 on your PC is directly visible from the internet.
How to read the scan result
- Open — something accepted a connection on port 5900. Work through the risks above.
- Closed — the packet reached the device, but nothing is listening on that port, so it was refused immediately (RST). The service is off.
- Filtered — no response. A firewall or the ISP is dropping packets, or the device is off. From an exposure point of view this is the safest state.
The verdict can depend on where you connect from. Many ISPs (including most Korean ISPs) block some ports such as 135, 139 and 445 on their network, so the same server can look Filtered from inside that network and Closed from abroad.
FAQ
- Does turning on Mac "Screen Sharing" open port 5900?
- Yes. Mac Screen Sharing is VNC-compatible and listens on port 5900. As long as you do not port-forward it on your router, it is not visible from outside.
Related ports
Last updated 2026-11-04 · Use this guide to check systems you manage. Scanning systems without permission may carry legal liability.