ZFS group ownership

Nate Eldredge nate at thatsmathematics.com
Tue Sep 15 22:32:17 UTC 2009


On Sat, 12 Sep 2009, Giulio Ferro wrote:

> I don't know if this is the correct list to discuss this matter, if not
> I apologize in advance.

freebsd-questions might have been better, but I don't think you're too far 
off.  It wasn't necessary to post three times though :)

[On UFS, files are created with the same group as the directory that 
contains them.  On ZFS, they are created with the primary group of the 
user who creates them.]

> What I ask now is: is this a bug or a feature?

Both, I think :)

The behavior you describe on UFS (group comes from the directory) is 
standard for BSD-based systems like FreeBSD.  On SysV-based systems, 
however, the default is that the group comes from the user, as you 
describe on ZFS.  ZFS was originally developed for Solaris, a descendent 
of SysV, so it's not surprising that it also has this behavior.  However, 
this is at least a documentation bug, since the open(2) man page describes 
the BSD behavior without mentioning exceptions.

> How can I achieve my goal in ZFS, that is allowing members of the same
> group to operate with the files / dirs they create?

On SysV, you can get BSD-type behavior by setting the sgid bit on the 
directory in question, e.g. "chmod g+s dir".  Then new files will inherit 
their group from the directory.  I suspect this will work on FreeBSD/ZFS 
too even though "chmod g+s" on a directory is undocumented.

-- 

Nate Eldredge
nate at thatsmathematics.com


More information about the freebsd-hackers mailing list