HTTPfy

Port 5938 (TeamViewer)

TeamViewer's preferred connection port (it falls back to 443 and 80).

Registered (user) port, 1024-49151 TCPUDP Remote access Do not expose to the internet

What port 5938 is used for

TeamViewer's preferred connection port (it falls back to 443 and 80).

Security: should port 5938 be open?

Do not expose to the internet. Only outbound is needed. Blocking it does not stop TeamViewer since it falls back to 443; control it via policy instead.

IANA assignment

Port 5938 is in the registered range and has no IANA assignment. The usage above is unofficial but widespread.

Check what is listening on port 5938

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

Test it from outside

From another machine
nc -vz -w 5 HOST 5938
From Windows
Test-NetConnection HOST -Port 5938
UDP probe (no reply does not prove it is closed)
nc -vzu -w 5 HOST 5938

Block port 5938 in the firewall

ufw
sudo ufw deny 5938/tcp
iptables
sudo iptables -A INPUT -p tcp --dport 5938 -j DROP
nftables
sudo nft add rule inet filter input tcp dport 5938 drop
Windows Firewall
New-NetFirewallRule -DisplayName 'Block TCP 5938' -Direction Inbound -Protocol TCP -LocalPort 5938 -Action Block
ufw
sudo ufw deny 5938/udp
iptables
sudo iptables -A INPUT -p udp --dport 5938 -j DROP
nftables
sudo nft add rule inet filter input udp dport 5938 drop
Windows Firewall
New-NetFirewallRule -DisplayName 'Block UDP 5938' -Direction Inbound -Protocol UDP -LocalPort 5938 -Action Block

Related ports

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