Samba Tips for your Linux Family Share

With my new Linux Mint PC and its huuuge hard drive it seemed a good time to create a Samba Share for the family. The family includes users on both Windows and Linux PCs. We're going to create our share at /ubuntuland/family on my sweet Linux Mint PC.

Proof of Concept

Let's start with some screenshots of the Family Share in action, first the directory from Windows.

And on Linux Mint Cinnamon — a much more attractive version :-).

We even have a handy Shortcut to the Share on the Windows Desktop.

Samba Configuration Tool Tip

I blogged about Samba before, mentioning that you had to install (and possibly re-install) the Samba Configuration Tools GUI.

That may not be enough, as you may launch Samba with the configuration tools installed and still nothing happens. No cool GUI for you! This Ask Ubuntu thread has the solution for that. We could be missing a /etc/libuser.conf file which prevents Samba Configuration from loading, so a quick

$ sudo touch /etc/libuser.conf

gets us up and running.

Create Your Samba User Accounts

Samba requires existing Linux accounts when creating Samba Share Users. We're going to create a group named rockers for the family share with a Samba User Account for a Windows Family Member named sally. We already created her account on our Linux box.

$ sudo smbpasswd -a sally
$ sudo groupadd rockers
$ sudo chown :rockers /ubuntuland/family
$ sudo usermod -G rockers sally


This can be the tricky part of Samba because there are authentication levels between Samba users and the Linux ACL. To not be overruled on your own Linux box on file operations of your Share, I advocate not even creating a Samba account for yourself. Simply include yourself in the Samba group you created earlier, or rockers for our case.

A couple of bash commands to keep at the ready if you go this route. First we want to enforce all files be created with the group assignment of the parent directory or rockers.

$ sudo chmod g+s /ubuntuland/family

For further control of the Shared Folder as seen from our native Linux User perspective we can set the default Group and Other permissions of new content.

$ setfacl -m "default:other::r" /ubuntuland/family
$ setfacl -m "default:group::rw" /ubuntuland/family

Now all files are writable to all Samba users from either direction because they are in the rockers group and will be saved with 664 permissions.

Create Mask and the smb.conf

Here's an excerpt from the /etc/smb.conf file to complete our permission config on the Samba Side.

path = /ubuntuland/family
writeable = yes
valid users = dave, sally
create mask = 0664
force create mode = 0664
directory mask = 0775
force directory mode = 0775
force group = rockers

One Final Tip

You will be updating the /etc/smb.conf file while you're getting your configuration just the way you like it. While doing so the following bash statement is your friend.

$ sudo service smbd restart