Port 445 is SMB, the Windows file and printer sharing protocol. It also carries named pipes used for remote administration and Active Directory. It should not be reachable from the public internet.
- Port
- 445
- Protocol
- TCP
- Service
- SMB
- Expose to internet?
- No
- Also used by
- Windows file sharing, Samba, Active Directory
Is port 445 safe to open?
SMB on the internet is one of the most dangerous exposures there is. The EternalBlue exploit against SMBv1 let WannaCry and NotPetya spread between machines in 2017, and SMB still attracts password spraying and relay attacks. Many ISPs block port 445 for this reason.
How to secure SMB
- Block TCP 445 at the internet edge without exception.
- Disable SMBv1:
Set-SmbServerConfiguration -EnableSMB1Protocol $falseon Windows,server min protocol = SMB2on Samba. - Require SMB signing, and SMB encryption for sensitive shares.
- Access remote file shares over a VPN, or use SMB over QUIC on supported Windows Server editions.
Check if port 445 is open
Linux: what is listening on this port
sudo ss -tlpn | grep ':445 'Windows (PowerShell): what is listening
Get-NetTCPConnection -LocalPort 445 -State Listen | Select-Object LocalAddress, OwningProcess, @{n='Process';e={(Get-Process -Id $_.OwningProcess).Name}}From another machine: is it reachable
nc -zv HOST 445
# or
nmap -p 445 HOST
# Windows
Test-NetConnection HOST -Port 445Test the SMB service itself
smbclient -L //HOST -NRestrict port 445 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:445:445) 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 445 proto tcp
sudo ufw deny 445/tcpfirewalld: allow one source network only
sudo firewall-cmd --permanent --remove-port=445/tcp
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="445" protocol="tcp" accept'
sudo firewall-cmd --reloadiptables
sudo iptables -A INPUT -p tcp --dport 445 -s 10.0.0.0/8 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 445 -j DROPWindows Firewall (PowerShell, as Administrator)
New-NetFirewallRule -DisplayName "Block 445 from internet" -Direction Inbound -Protocol TCP -LocalPort 445 -RemoteAddress Internet -Action BlockMonitor port 445
Run a TCP port monitor against your public IP on port 445: 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
| Port 139 | NetBIOS Session Service (SMB over NetBIOS) | High risk |
| Port 135 | Microsoft RPC endpoint mapper | High risk |
| Port 3389 | Remote Desktop (RDP) | High risk |
FAQ
Should port 445 be open?
Only on internal networks where machines share files or join a domain. It should never be reachable from the internet.
Can I access an SMB share over the internet?
Not safely by opening 445. Use a VPN, or SMB over QUIC on supported Windows Server editions, which runs over UDP 443 with TLS.
What is port 445 used for?
Port 445 is SMB, the Windows file and printer sharing protocol. It also carries named pipes used for remote administration and Active Directory. It is also used by Windows file sharing, Samba, Active Directory.
Is port 445 TCP or UDP?
SMB uses TCP on port 445.
How do I check if port 445 is open?
On the server, run sudo ss -tulpn | grep ':445 ' (Linux) or Get-NetTCPConnection -LocalPort 445 (Windows) to see what is listening. From another machine, run nc -zv HOST 445 or Test-NetConnection HOST -Port 445.
Know the moment a port stops answering.
TCP, HTTP, DNS and SSL checks from six regions, plus server metrics from a one-line agent.