1

I have setup a Samba share on Ubuntu 12.04 for our finance team, and they access it via Windows 7 and Mac OS X. They mount the share using their LDAP credentials. All of our LDAP users have "employees" as their primary group, and the finance team belongs to a secondary group named "finance".

When any of the finance team members create a folder within the Samba share, the folder's group defaults to "employees". How can I force all files and folders created on the share to have the group set to "finance"?

2 Answers 2

3

For share foo, with path /bar/foo, the following in your smb.conf file should do it:

[foo]
        path = /bar/foo
        force create mode = 0020
        force directory mode = 0030
        force group = +finance

The mode statements are to ensure that all directories and files created via samba are group-writeable: it's no good just being group-owned by the right group if that group has no privileges to do anything.

3
  • Can you explain how "force create mode" and "force directory mode" work? I can't really figure out what this is telling me: samba.org/samba/docs/man/manpages-3/…
    – zymhan
    Jun 21, 2013 at 20:14
  • 1
    As used above, the first says that regular files must have the group-write bit on, whatever else they may or may not have; the second that all directories must have the group write and execute bits on, whatever else they may or may not have.
    – MadHatter
    Jun 21, 2013 at 20:32
  • Gotcha, thanks. I like this solution the best, as I can use it within my samba configuration.
    – zymhan
    Jun 21, 2013 at 21:44
1

You can use setfacl for this purpose. Man setfacl here. Setfacl allows you to set ownerships and rights different than default ones. Here is a similar question which can also helps you:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .