Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Simple question: I have a NATed Linux at home that hosts a couple of samba shares. What Ports should I forward from the router to the Linux box so as to be able to access those shares from the internet with windows explorer (a la "\\shares\xxx" style)? I want the minimum number of port openings that I should do in the router config to have read/write functionality.

EDIT: Client machine is a Vista one

share|improve this question
  • TCP 139, "NetBIOS Session" – SMB wrapped in NetBIOS for compatibility
  • TCP 445, SMB – the preferred method, SMB directly over TCP
  • ICMP Echo (Ping) – used by Windows to check whether the machine is up.

"NetBIOS Name Service" is TCP/UDP 137, and "NetBIOS Datagram" is UDP 138, but you do not need any of these to connect to shares. These days it is only necessary for "network browsing", which only works within a LAN anyway.

share|improve this answer
Aha you're right. Although my 'answer' would have worked i think, I've edited it to the preferred solution. I still reckon openssh is a better way to go. – PriceChild Apr 14 '11 at 9:35
Vista has a problem making 445 work with forwarding. See my answer for a nice solution link about how to do CIFS over SSH on Vista. – Paralife Apr 14 '11 at 13:44

445 for tcp

Contrary to the original answer here, there's no reason to allow 137-139 which should be blocked.

However, I strongly recommend you do not do this. I don't think leaving a samba share internet-accessible is a good idea.

Please please please set up a secure solution such as an ssh server, so that you can scp/sftp data back and forth.

P.s. seems to be a good reference of ports required by windows servers and explains the above a little more in depth.

share|improve this answer
Thanks I am so ** stupid, I ve been trying all day, but forgot UDP... – Paralife Apr 14 '11 at 8:32
Also for the security issue I ll try to do it over ssh tunnels. Wouldnt be this secure enough? – Paralife Apr 14 '11 at 8:32
...btw, can ssh tunneling handle udp connections? – Paralife Apr 14 '11 at 8:36
Tunneling samba through ssh is certainly possible, here's a guide: – PriceChild Apr 14 '11 at 8:39
139 is not for browsing... Older Windows versions use it for the SMB protocol, wrapped inside a NetBIOS session. So it has exactly the same security issues as 445 (raw SMB). – grawity Apr 14 '11 at 10:44
up vote 0 down vote accepted

OK here is a guide that could make my grandma do it in 5 mins. Worked without a glitch

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .