Port 445 (SMB)

Port 445 is the TCP port of SMB (Server Message Block), the protocol behind file and printer sharing in Windows.

Key facts

Port
445
Protocols
TCP
Range
System port (Well-Known), 0-1023
IANA service name
microsoft-ds

IANA assigns ports in this range to well-known services, under RFC 6335.

About port 445

Port 445 is the TCP port of SMB (Server Message Block), the protocol behind file and printer sharing in Windows. On port 445, SMB runs directly over TCP, without NetBIOS, unlike the older port 139.

Microsoft publishes the protocol specification (SMB2 and SMB3), and IANA registers port 445 for the microsoft-ds service.

What port 445 is used for

  • Shared folders: Windows computers, file servers, and NAS devices share folders on the network through port 445.
  • Shared printers: printing to a printer connected to another computer or server on the network.
  • Corporate networks: domain controllers distribute policies and logon scripts to computers over SMB.
  • Linux servers: the Samba service provides shared folders to Windows computers, and Linux servers can mount a shared folder with mount -t cifs.

Port 445 in the firewall

Microsoft recommends blocking port 445 for incoming traffic from the internet, and also for outgoing traffic to the internet when it isn't needed. Open the port only to the local network or the VPN network:

  • UFW: ufw allow from 192.168.1.0/24 to any port 445 proto tcp
  • firewalld: firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="445" protocol="tcp" accept'

In firewalld, you can also use the predefined samba service in the internal zone, and assign only your local network addresses to that zone. To reach shared folders from outside the office, connect to a VPN first, and don't open port 445 to the internet.

Risks and security

SMB is meant for a local network. A server with port 445 open to the internet becomes a target for automated scans and password-guessing attempts, and in the past, worms such as WannaCry spread through a vulnerability in the old SMB1 version. The following settings keep file sharing secure:

  • Block incoming traffic from the internet to port 445, and open it only to the local network or the VPN.
  • Don't use SMB1. In current versions of Windows it isn't installed by default, and in Samba the default minimum protocol version is SMB2.
  • Keep SMB signing enabled. Current versions of Windows require it by default. With SMB3, you can also encrypt the traffic.
  • Give each user access only to the folders they need, and install security updates regularly.

Commands to check and configure

  • Test-NetConnection 192.168.1.10 -Port 445

    Checks from PowerShell on Windows whether port 445 is open on the given computer.

  • Get-SmbServerConfiguration | Select EnableSMB1Protocol

    Checks on Windows whether the server allows SMB1 connections (False means SMB1 is off).

  • Set-SmbServerConfiguration -EnableSMB1Protocol $false

    Turns off SMB1 on a Windows server (as administrator). Older equipment that supports only SMB1 won't be able to connect, so check for it before the change.

  • ss -tlnp | grep ':445 '

    Checks whether any service is listening on port 445 on a Linux server, and which process it is (requires root).

  • smbclient -L //192.168.1.10 -U user

    Lists the shared folders the server shows to the given user (asks for a password).

  • ufw allow from 192.168.1.0/24 to any port 445 proto tcp

    Allows access to port 445 only from the given local network (UFW).

  • firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" port port="445" protocol="tcp" accept'

    Allows access to port 445 in firewalld only from the given local network. Then run firewall-cmd --reload.

Port 445 in the IANA registry

Port Protocol Service IANA registry description
445 TCP microsoft-ds Microsoft-DS
445 UDP microsoft-ds Microsoft-DS

Data source: IANA Service Name and Transport Protocol Port Number Registry (opens in a new tab)

Port 445 FAQ

Can I access a shared folder over the internet?

Yes, but not by opening port 445 to the internet. The common way is to connect to the network over a VPN first, and only then open the shared folder. The Firewall and VPN page has details on connecting securely to your network, and our Cloud office service lets you work with your files from anywhere.

What's the difference between SMB1, SMB2, and SMB3?

SMB1 is the old version, and Microsoft recommends not using it. SMB2 greatly improved performance and security, and SMB3 added, among other things, traffic encryption. Current computers and servers automatically choose the highest version both sides support.

How do I mount a Windows shared folder on a Linux server?

Install the cifs-utils package, create an empty folder, and run, for example, mount -t cifs //192.168.1.10/share /mnt/share -o username=user. For a permanent mount, add a matching line to /etc/fstab, and keep the login details in a separate file with restricted permissions.

What's the difference between port 445 and port 139?

SMB runs on both ports. On port 139, it runs over NetBIOS, the older method. On port 445, it runs directly over TCP, and that's the method current computers and servers use.

Shopping cart

Your cart is emptyYou can start with one of our popular plans.

Site search

Accessibility

Text size
100%
Accessibility statement