Port 139 (NetBIOS Session)

Port 139 is the TCP port of the NetBIOS Session Service, which older Windows computers used to carry file and printer sharing (SMB) over NetBIOS.

Key facts

Port
139
Protocols
TCP
Range
System port (Well-Known), 0-1023
IANA service name
netbios-ssn

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

About port 139

Port 139 is the TCP port of the NetBIOS Session Service, which older Windows computers used to carry file and printer sharing (SMB) over NetBIOS. Current computers and servers carry SMB directly over TCP, on port 445, without NetBIOS.

NetBIOS over TCP/IP is defined in RFC 1001 and RFC 1002, and IANA registers port 139 for the netbios-ssn service.

What port 139 is used for

  • File sharing with older equipment: older computers, NAS devices, and printers that support only SMB over NetBIOS connect to shared folders through port 139.
  • Samba server: the Samba service on Linux servers listens on both port 139 and port 445 by default, to support older equipment.
  • Finding computers on the local network: NetBIOS also uses ports 137 and 138 for computer name lookups, and they work together with port 139 on older networks.

According to Microsoft, shares that use SMB2 and later don't use ports 137 to 139. In current versions of Windows, the built-in firewall rules for file sharing no longer open these ports.

Port 139 in the firewall

Don't open port 139 to the internet. When you need it, open it to the local network only:

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

When all the computers on the network support SMB2 and later, you can keep port 139 closed and open only port 445 to the local network. To reach shared folders from outside the office, connect to a VPN first.

Risks and security

NetBIOS services are meant for a closed local network. When they're exposed to the internet, they may reveal computer names and shared folders, and allow password-guessing attempts. In addition, equipment that still needs port 139 usually also uses SMB1, an old version with known vulnerabilities.

  • Block incoming traffic from the internet to port 139 in the firewall.
  • When there's no older equipment on the network, turn off NetBIOS. On a Samba server, you do this with the setting disable netbios = yes.
  • Prefer SMB2 and later, and update or replace equipment that supports only SMB1.
  • Limit access to shared folders to the users and addresses that need it.

Commands to check and configure

  • ss -tlnp | grep ':139 '

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

  • Test-NetConnection 192.168.1.10 -Port 139

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

  • smbclient -L //192.168.1.10 -U user

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

  • testparm -s

    Checks the Samba configuration file and shows the active settings, including disable netbios when it's set.

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

    Allows access to port 139 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="139" protocol="tcp" accept'

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

Port 139 in the IANA registry

Port Protocol Service IANA registry description
139 TCP netbios-ssn NETBIOS Session Service
139 UDP netbios-ssn NETBIOS Session Service

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

Port 139 FAQ

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

Both ports are used for file and printer sharing over SMB. On port 139, SMB runs over NetBIOS, the older method. On port 445, SMB runs directly over TCP, and that's the method current computers and servers use.

Does a modern network still need port 139?

In most cases, no. When all the computers and devices on the network support SMB2 and later, file sharing works through port 445 only. Port 139 is needed only for older equipment that supports nothing but SMB over NetBIOS.

How do I reach shared folders from outside the office?

The common way is to connect to the office network over a VPN first, and only then open the shared folders, as if you were in the office. This way, ports 139 and 445 stay closed to the internet. The Firewall and VPN page has details on connecting securely to your network.

How do I check which shared folders the server shows?

On Linux, run smbclient -L //192.168.1.10 -U user to get the list of shared folders the user is allowed to see. On Windows, you can type the address \\192.168.1.10 in File Explorer.

Shopping cart

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

Site search

Accessibility

Text size
100%
Accessibility statement