Make samba create files with usable group permissions

I am using Samba as my file server at home and connecting to it from two different users on their own macbook laptops. The Debian server has a share directory in /var/share that either myself or any other user on the system can connect to and create files or directories in. We all want to be able to edit each others files in addition to adding or removing directories and files as well, regardless of who created or owns them.

First, I created a directory in /var/share that is owned by one user, with group of “users”. All users with access to this share are members of the ‘users’ group on the file server.

Below is the config for the /var/share folder, as defined in /etc/samba/smb.conf

These should be obvious what they do if you’re familiar with permission in unix, “inherit permissions = yes” will inherit the permissions from the parent directory. “directory mask” and “create mask” refer to directory permissions and file permissions respectively. The “valid user = @users” refers to any user in the “users” group on the system, which will allow them to access the share.

The “force group = users” will force any directory or file to be owned by “:users”.

You might need to fix your existing files and directories for this to work properly.

This will make every file and directory in /var/share belong to the ‘users’ group:

This wlll make every file 664 (user+group writable):

This will make every directoy 775 (user + group writable):

  • pkelly

    I’m about to pull my hair out over this stuff…it would be great if you could help me. I want to accomplish the exact same thing you did, but I want to do this with automounted USB drives. I have udev automounting drives with udisks2. It automounts them to /media/[name of usb drive]. All users are part of the wheel group. my primary user is pkelly. So I’d like my perms to be rwxrwx— for everything regardless who creates it with group owner “wheel”. I can set the perms recursively for everything and it still doesn’t let me write, even though I’m a part of the wheel group. I’m just so confused and frustrated. Please help. Let me know what info you need from me thanks in advance!

  • PePas

    The last line should have a ‘d’ instead of an ‘f’.

    • chovysblog

      thanks. fixed it.