What port does SMB use?
SMB uses port 445 over TCP.
| Port | Protocol | Name | What it is for |
|---|---|---|---|
| 445 | TCP | SMB | Windows file and printer sharing. |
What catches people out
Should never be reachable from the internet. This is the port WannaCry and NotPetya spread over.
Checking it is listening
sudo lsof -i :445 # macOS, Linux
netstat -ano | findstr :445 # Windows
nc -zv host 445 # from elsewhere
An "address already in use" error on a port nothing appears to be holding usually means the socket is in TIME_WAIT rather than that a process has it — the ports reference covers that and the ephemeral range.
Frequently asked questions
What port does SMB use?
SMB uses port 445 over TCP. Windows file and printer sharing.
What should I watch out for with port 445?
Should never be reachable from the internet. This is the port WannaCry and NotPetya spread over.
How do I check whether SMB is listening?
sudo lsof -i :445 on macOS or Linux, netstat -ano | findstr :445 on Windows. From another machine, nc -zv host 445 says whether anything answers.