How to mount a samba share on non-standard port?

13

5

The firewall on my network drops all packets on TCP port 139 and 445. So all samba shares don't work outside the LAN.

I tried letting the samba daemon listen on a non-standard port. This method works well for linux, because both smbclient and smbmount has an option to set server port. But on windows I cannot find a similar option.

Does Windows support mounting smb shares on non-standard ports? Third-party softwares are also acceptable.


Edit:

\\hostname:port\share in Windows explorer doesn't work. Strangely, I can see the connection is established on the server. But Windows keeps telling me that the server couldn't be reached. It doesn't work even in LAN with standard port 445, in which case a path without port number will get through.

hpsMouse

Posted 2014-01-17T07:26:05.890

Reputation: 301

In your case I would use a port redirector running on my local 127.0.0.1:139 and on 127.0.0.1:445, and I would redirect them to your destination ip. But I think a VPN solution would be more feasible (for example, openvpn). – peterh - Reinstate Monica – 2018-01-24T11:01:34.927

Have you tried setting the port in the url? smb://myhost:555/my/path/to/share – Gjordis – 2014-01-17T08:08:28.957

2@Gjordis: Yes and it fails. See my edit. – hpsMouse – 2014-01-17T08:39:39.180

Answers

1

Unfortunately, it is not possible as windows does only support ports 445 and 139

You might be able to use ssh tunneling. Here is a reference using windows and linux: https://www.ocf.berkeley.edu/~xuanluo/sshproxywin.html

user138278

Posted 2014-01-17T07:26:05.890

Reputation: 265

Do you have a reference for the claim that Windows only supports 445 and 139? I don't doubt it, but it would be nice to see something official, if it exists. – Ben Mares – 2020-02-18T11:55:16.327