Port 5985: WinRM HTTP

Port 5985 (TCP) is used by WinRM HTTP. Windows Remote Management / PowerShell remoting over HTTP.

5985Port
TCPProtocol
wsmanIANA service name
Windows networkingCategory

Port range

5985 is a registered port (range 1024–49151). Any user can bind to it; IANA records which service registered the number.

Security

Port 5985 should not be reachable from the public internet. Restrict it to trusted networks or a VPN, and scan your public IP to confirm it is closed.

Open port 5985 in a firewall

ufw         sudo ufw allow 5985/tcp
iptables    sudo iptables -A INPUT -p tcp --dport 5985 -j ACCEPT
firewalld   sudo firewall-cmd --permanent --add-port=5985/tcp
Windows     New-NetFirewallRule -DisplayName "WinRM HTTP 5985" -Direction Inbound -Protocol TCP -LocalPort 5985 -Action Allow

Check if port 5985 is open

nc -vz example.com 5985
Test-NetConnection example.com -Port 5985   # PowerShell
sudo ss -tulpn | grep ':5985 '   # what is listening locally (Linux)

Other windows networking ports

Frequently asked questions

What is port 5985 used for?
WinRM HTTP. Windows Remote Management / PowerShell remoting over HTTP.
Is port 5985 TCP or UDP?
TCP.