Toolman

What port does SMB use?

SMB uses port 445 over TCP.

PortProtocolNameWhat it is for
445TCPSMBWindows file and printer sharing.

Exposing it

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.

Is port 445 safe to expose to the internet?

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.

Other services

Port 445 in full · Every service · All port numbers