Re: Stephen White's proposal involving a `private' group
Hi,
I just want to state a technical point here, no flame intended :-)
Ian Jackson writes:
>
> It should also be noted that Stephen White's proposal won't work
> unless the home directories filesystem and /tmp are both mounted with
> BSD semantics.
>
> This is because the setgid bit doesn't get propagated to
> subdirectories you create unless you're a member of the group in
> question.
This is untrue. If you look at the ext2fs code (in file
fs/ext2/ialloc.c), at line 479:
if (test_opt (sb, GRPID))
/*
* Using BSD semantics, gid is inherited by the new inode
*/
inode->i_gid = dir->i_gid;
else
/*
* Using System V semantics
*/
if (dir->i_mode & S_ISGID) {
/*
* setgid directory, gid is inherited
*/
inode->i_gid = dir->i_gid;
if (S_ISDIR(mode))
/*
* setgid bit is inherited on subdirectories
*/
mode |= S_ISGID;
} else
/*
* Non setgid directory, use the creator gid
*/
inode->i_gid = current->egid;
I have slightly edited the code (to add comments). As you can see in
the code, the gid of a setgid directory is inherited by its subdirectories
even if the creator does not belong to the group. This works the same way in
other filesystems.
>
> Ian.
>
Remy
Reply to: