Videos
Yes, modern SMB (especially v2/v3) runs only on TCP port 445. However, Windows clients may also expect the server to be pingable, i.e. respond to ICMP Echo, before they even attempt a SMB connection.
Also, it could be that Windows implicitly maps all local address to a magic loopback connection that bypasses the TCP/IP stack entirely and is therefore unaware of your SSH tunnel. I would definitely recommend an IP-level VPN instead.
Only very old clients, Windows 9x era and older, will expect TCP port 139 instead (and possibly the NetBIOS Datagram service on UDP 137-138).
Recently, Microsoft has announced an experimental SMB-over-QUIC which can use UDP port 443 as alternative. This is not yet publicly available.
I would say the answer is that you do need TCP port 139 open. This question came up in Google for me while researching the ports necessary to open on our corporate firewall for an SMB connection to Azure Files (from a different virtual network separated by a firewall) and after looking at the firewall deny logs, I can confirm that we see both 139 and 445 blocked by the firewall for our SMB version 3.1.1 connection to the storage account share.
Edit: After some more research, I found this article which states that NetBT (NetBIOS over TCP/IP) uses port 139. The port 445-only implementation of SMB is called Direct host SMB over TCP/IP
It may be that your server side setting is still trying to use NetBT and you need to follow the steps on the second link above to disable NetBT so that the server will exclusively work on port 445.
I have a Server 2016 VM which is connected to SMB share on a Server 2016 Failover Cluster File Server(s). One of the datastreams is attempting to connect to TCP port 52008 on the Failover Cluster, but is blocked by a firewall which sits in-between. SMB appears to be working fine with this connection blocked. If I run netstat on the active cluster node, it shows that the clussvc.exe process is listening on this port.
Does anyone know why SMB is trying to use this port? And what exactly this port is used for? I've tried googling it but can't seem to find anything.
