Jamie Adams

Easy public SAMBA shares

I use Samba to share files with my Linux based media servers. It’s a pain in the arse and I hate it. Getting a share on the network is easy but the permissions punch me in the face. I’ll often end up with a share writable by one user but not another, or writable by many users but the files only readable by other users. Last week the whole wobbly system broke down because of a permissions issue and I was forced to figure it out once and for all. Turns out that I was over thinking it, and that it’s actually quote simple. Assuming that Samba is already installed, here’s a simple method for creating a public Samba share:

Step 1: Create the share location

sudo mkdir -p /share/media    
sudo chown root:users /share/media
sudo chmod 2775 /share/media 

Step 2: Add your local user to the ‘users’ group.

sudo adduser <username> users

Step 3: Configure SAMBA

Add the following to the bottom of /etc/samba/smb.conf

comment = Shared Data    
path = /share/media    
browseable = yes    
guest ok = yes    
force group = users    
writeable = yes    
create mask = 0664    
force directory mode = 0775  

Finally, restart Samba to initialise the new configuration.
sudo service smbd restart

You might need to log out and back in again for the permission changes in step 1 to take effect.

Permalink: https://jamieadams.me.uk/2017/easy-public-samba-shares/