How can I access my Samba share from outside the network ?


I use SMB/Samba file share on my Pi to access the data stored on my HDD plugged in the Pi. It works very well.
But right now I can only access the file server on the same network as the pi.

How can I access it from the outside ?
I already have a DDNS. I tried to find what port SMB uses, but I always get a different answer. What port should I open ? Is there something more I should do ?

Thanks in advance for your help.
Have a great day.


many thanks for your request. Theoretically Port 445 TCP should be enough. But do you relay want to open SMB port towards internet? Personally I would not do that. Why not using a VPN to connect from outside world to your RPi back home? It would be much more safer :slight_smile:

Thanks a lot for your answer. It works : opening port 445 makes it work outside the network. I had so much different answers elsewhere.
That’s the 2nd time you’re helping me for SMB, so thanks again !

Yes I know opening too much ports is not ideal. I already have Pivpn with Wireguard, which is what I was using to access SMB from the outside. But now I have the need to access both my SMB from outside, plus other devices on the same network as me. At the same time. So VPN was a bit of a hassle for this.

Thanks again and have a good day !

I’m using WireGuard since the beginning and for me it’s perfect solution. I installed the client on all my devices such as laptop, mobiles and tablets. Once I’m outside my home, I can connect to any device in my local network as well as using ad-blocking via my PiHole.