1

I have a folder, /srv/share, which I'd like to share between a few users who share a non-primary group (share). I'd like to force that any file and/or directory moved or created into /srv/share are owned by the share group. I'm using FreeBSD 11 and the share is on a ZFS volume.

As of now, this almost works - I'm using setgid on the folder (which is already owned by share), and if I create a subdirectory it is owned by the correct group. However, if an application running as a user who is member of the share group moves files in a directory into /srv/share, the files are owned by the application user's group.

How should I setup this? I'm lost and two evenings of googling has given me almost nothing.

2
  • Why do you need to force group ownership if you can directly grant it access via ACLs? Commented Dec 28, 2016 at 21:20
  • The volume is shared over network and it makes it easier to setup accounts, at least from what I've learned so far.
    – monotux
    Commented Dec 28, 2016 at 21:24

1 Answer 1

0

(I don't have a freebsd console available to me atm, but this appears to work on Mac OS X):

chown :share /srv/share

chmod g+s /srv/share

mv within the same mounted filesystem normally retains the ownership and permissions as the file existed in its origin location. However, across mounted filesystems I would expect the behavior to look more like cp followed by unlink. Therefore, I believe the g+s should have the required behavior.

You must log in to answer this question.

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