Port 3389 is Microsoft Remote Desktop Protocol, used to control Windows desktops and servers remotely. Recent Windows versions also use UDP 3389 to improve performance. It should not be reachable from the public internet.
- Port
- 3389
- Protocol
- TCP and UDP
- Service
- Remote Desktop (RDP)
- Expose to internet?
- No
- Also used by
- Windows Remote Desktop Services, xrdp
Is port 3389 safe to open?
RDP exposed to the internet is one of the most common ways ransomware gangs get into networks, usually through guessed or stolen passwords. Serious pre-authentication flaws such as BlueKeep have also affected RDP. If remote access is needed, put RDP behind a VPN or Remote Desktop Gateway.
How to secure Remote Desktop (RDP)
- Do not expose 3389 directly; use a VPN, Remote Desktop Gateway or a zero-trust access service.
- Require Network Level Authentication (NLA).
- Set an account lockout policy and use long passwords; add MFA through RD Gateway where possible.
- If it must be reachable, allow only specific source IP addresses.
- Keep Windows patched.
Check if port 3389 is open
Linux: what is listening on this port
sudo ss -tulpn | grep ':3389 'Windows (PowerShell): what is listening
Get-NetTCPConnection -LocalPort 3389 -State Listen | Select-Object LocalAddress, OwningProcess, @{n='Process';e={(Get-Process -Id $_.OwningProcess).Name}}From another machine: is it reachable
nc -zv HOST 3389
# or
nmap -p 3389 HOST
# Windows
Test-NetConnection HOST -Port 3389Test the Remote Desktop (RDP) service itself
Test-NetConnection -ComputerName HOST -Port 3389Restrict port 3389 in the firewall
Replace 10.0.0.0/8 with the network or address that needs access. Docker publishes container ports through its own iptables rules, which bypass ufw; bind published ports to 127.0.0.1 (-p 127.0.0.1:3389:3389) instead of relying on the host firewall.
ufw: allow only your private network, deny everyone else
sudo ufw allow from 10.0.0.0/8 to any port 3389 proto tcp
sudo ufw deny 3389/tcpfirewalld: allow one source network only
sudo firewall-cmd --permanent --remove-port=3389/tcp
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="3389" protocol="tcp" accept'
sudo firewall-cmd --reloadiptables
sudo iptables -A INPUT -p tcp --dport 3389 -s 10.0.0.0/8 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 3389 -j DROPWindows Firewall (PowerShell, as Administrator)
New-NetFirewallRule -DisplayName "Block 3389 from internet" -Direction Inbound -Protocol TCP -LocalPort 3389 -RemoteAddress Internet -Action BlockMonitor port 3389
Run a TCP port monitor against your public IP on port 3389: here, a failed connection is the healthy result, so you know the firewall is still doing its job. On Linux, the Statance agent also reports every listening port on the server. TCP port monitoring.
Related ports
FAQ
Is it safe to open port 3389 to the internet?
Not recommended. Exposed RDP is constantly brute-forced and is a leading entry point for ransomware. Use a VPN or Remote Desktop Gateway, or restrict the port to known IP addresses.
Does changing the RDP port help?
It reduces automated noise but does not stop targeted scans. NLA, strong passwords, lockout and a VPN are what protect it.
What is port 3389 used for?
Port 3389 is Microsoft Remote Desktop Protocol, used to control Windows desktops and servers remotely. Recent Windows versions also use UDP 3389 to improve performance. It is also used by Windows Remote Desktop Services, xrdp.
Is port 3389 TCP or UDP?
Remote Desktop (RDP) uses TCP and UDP on port 3389.
How do I check if port 3389 is open?
On the server, run sudo ss -tulpn | grep ':3389 ' (Linux) or Get-NetTCPConnection -LocalPort 3389 (Windows) to see what is listening. From another machine, run nc -zv HOST 3389 or Test-NetConnection HOST -Port 3389.
Know the moment a port stops answering.
TCP, HTTP, DNS and SSL checks from six regions, plus server metrics from a one-line agent.