13

I have an Ubuntu server in my house running samba. I'm trying to set up a samba share where everyone has read and write access.

I have all the users in a 'sambashare' unix group and want to offer the directory /data/shared to all members of the 'sambashare' group for read and write access.

Ideally if a user creates a file in there using samba it should have the permissions 0644 and be owned by username:sambashare

I can't work out what to put in the smb.conf file to make this work, or what unix permissions to give the /data/shared folder.

3 Answers 3

10

In smb.conf, in the shared directory section, place:

create mask = 0644
directory mask = 2777

Initially, use g+s permission on all directories and chown them for the sambashare group. The s bit will keep the group of the files created the same as the directory group (and 2777 will take care of the s bit on the new directories).

1
  • Hello I have tried this but it is not working! Can you have a look at my question
    – maxisme
    Mar 14, 2015 at 14:37
6

To allow everyone from the group SAMBASHARE to access the shares add the following to the [global] directive:

create mode = 664
workgroup = SAMBASHARE
security = user
usershare allow guests = yes

To export /data/shared you have to add the following at the end of the file:

[data]
comment = shared
path = /data/shared
guest ok = yes
read only = no
public = yes
writable = yes

That should work for you, but I strongly recommend to gather some more information.

1
3

After stuggling through this same problem and seeing a lot of unhelpful posts that "solved" this problem, I finally traced my problem down to one line in the specific share section I wanted to be group-writeable:

 force directory mode = 2770

The "2" is MANDATORY, and the Samba server won't make newly created directories group-writeable without this (i.e. 0770 is NOT sufficient). I'm using the Samba daemon in Ubuntu 12.04.01, with the standard windows client to create the directory.

It would be nice if this was documented in the smb.conf man page.....

Just for clarification, the following does NOT work for me (even with "unix extensions = off" -- the directories are created with permission 0750):

[MyShare]
   writeable = yes
   force group = somegroup
   ...
   directory mask = 0770
   directory security mask = 0770
   force directory mode = 0770
   force directory security mode = 0770
1
  • Thank you so much guy, i've been stuck on this issue for a whole day
    – f1rstsurf
    Jun 23, 2020 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.