What uses port 445
Windows file shares (\\server\share), mapped drives, printer sharing and many Active Directory operations use SMB directly over TCP 445. Samba provides the same protocol on Linux and macOS. SMB has a long history of wormable vulnerabilities, including EternalBlue used by WannaCry, so port 445 should never be reachable from the internet.
Should port 445 be open to the internet?
Keep private. Never expose this port to the internet. Keep it on localhost, a private network or behind a VPN or SSH tunnel.
- Many ISPs block port 445, so mounting an SMB share over the internet fails. Use a VPN, or a protocol designed for it such as SFTP or WebDAV over HTTPS.
-
Disable SMBv1 everywhere (
Set-SmbServerConfiguration -EnableSMB1Protocol $false); only very old devices need it.
Check what is listening on port 445
sudo ss -ltnp 'sport = :445'
sudo lsof -nP -iTCP:445 -sTCP:LISTEN
Get-NetTCPConnection -LocalPort 445 -State Listen
netstat -ano | findstr :445
No output means nothing is listening. If a service should be, check that it is running and which address it binds to: 127.0.0.1 only accepts local connections, 0.0.0.0 or :: accepts them on every interface.
Fix “address already in use” on port 445
Another process already holds the port. Find it with the commands above, then stop that service properly, or end the process:
sudo kill $(sudo lsof -t -iTCP:445 -sTCP:LISTEN)
Stop-Process -Id (Get-NetTCPConnection -LocalPort 445 -State Listen).OwningProcess
Allow port 445 from trusted networks only
The examples allow 445 only from 10.0.0.0/8; replace it with your own private network, office IP or VPN range.
sudo ufw allow from 10.0.0.0/8 to any port 445 proto tcp
# Close it again:
sudo ufw delete allow from 10.0.0.0/8 to any port 445 proto 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 --reload
New-NetFirewallRule -DisplayName "SMB 445/TCP" -Direction Inbound -Protocol TCP -LocalPort 445 -Action Allow -RemoteAddress 10.0.0.0/8
On AWS, Google Cloud and Azure, also allow the port in the security group or network firewall rules; host firewalls and cloud firewalls are separate.
Test port 445 from another machine
nc -zv example.com 445
Test-NetConnection example.com -Port 445
Related ports
- Port 139 (NetBIOS Session): used by NetBIOS session service, the legacy transport for Windows file sharing.
- Port 135 (Microsoft RPC): the Microsoft RPC endpoint mapper, used by many Windows services.
- Port 2049 (NFS): used by NFS, the Network File System.
- Port 88 (Kerberos): used by Kerberos authentication, including Active Directory logins.
More file sharing ports
20 (FTP data) , 21 (FTP) , 69 (TFTP) , 873 (rsync) , 990 (FTPS) . See all ports in the port lookup.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What is port 445 used for?
Port 445 is used by SMB for Windows file and printer sharing. Windows file shares (\\server\share), mapped drives, printer sharing and many Active Directory operations use SMB directly over TCP 445. Samba provides the same protocol on Linux and macOS. SMB has a long history of wormable vulnerabilities, including EternalBlue used by WannaCry, so port 445 should never be reachable from the internet.
Is it safe to open port 445?
Never expose this port to the internet. Keep it on localhost, a private network or behind a VPN or SSH tunnel. Allow it only from the networks that need it, as in the firewall examples on this page.
How do I check if port 445 is open?
On the server, list listening sockets with "sudo ss -ltnp 'sport = :445'" on Linux or "sudo lsof -nP -i :445" on macOS. From another machine, run "nc -zv host 445" or, on Windows, "Test-NetConnection host -Port 445". Connection refused means nothing is listening; a timeout means a firewall is dropping the traffic.