Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from serverfault.com Apr 24 '11 at 12:45

This question came from our site for system and network administrators.

3 Answers 3

up vote 5 down vote accepted

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).

share|improve this answer

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

create mode = 664
workgroup = SAMBASHARE
security = SHARE
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.

share|improve this answer

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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