← BACK TO GUIDES

Samba File Sharing Setup

Step-by-step setup of persistent Samba network shares, bind mounts, and user security permissions.

#NETWORK#STORAGE
Sharing external drives via Samba on Linux can be tricky due to permission isolation and mount point ownership.
A reliable solution is to create a bind mount from the external drive path to a clean directory under /var/samba/.
Test the bind mount interactively (optional):
sudo mount --bind /source/path/ /var/samba/folder/
To make the bind mount persistent across reboots, add an entry to /etc/fstab:
/var/run/media/user/sysdrives/drive2/Torrenting/distros /var/samba/distropub none bind,ro 0 0
The ,ro flag mounts it read-only. Adjust this if write access is needed, and ensure permissions on the directory allow Samba to access files.
Now add the share definition in /etc/samba/smb.conf:
[Distros] comment = Distros browsable = yes guest ok = no read only = yes create mask = 755 path = /var/samba/Distros valid users = user
Mount everything defined in /etc/fstab and restart Samba:
sudo mount -a
sudo systemctl restart smb