I have a git (actually git-annex) repository I'm trying to make shared, part of which involves setting the set-group-id bit on several directories. This is on a Debian GNU/Linux Stretch box, on an ext4 filesystem. For some odd reason, chmod g+s DIRECTORY is being ignored (blank lines around chmod block added for readability):
$ stat objects
File: objects
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fd06h/64774d Inode: 12353692 Links: 260
Access: (0775/drwxrwxr-x) Uid: ( 1000/ anthony) Gid: ( 1025/git-books)
Access: 2018-07-30 14:43:13.831641743 -0400
Modify: 2018-07-28 14:28:14.970667931 -0400
Change: 2018-07-30 14:46:38.179597449 -0400
Birth: -
$ chmod g+s objects
$ echo $?
0
$ stat objects
File: objects
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fd06h/64774d Inode: 12353692 Links: 260
Access: (0775/drwxrwxr-x) Uid: ( 1000/ anthony) Gid: ( 1025/git-books)
Access: 2018-07-30 14:43:13.831641743 -0400
Modify: 2018-07-28 14:28:14.970667931 -0400
Change: 2018-07-30 14:50:43.355539381 -0400
Birth: -
What I've checked so far:
- There do not appear to be any weird mount options (e.g.,
nosuid) that might block it from working. I checked both fstab and/proc/mounts, which shows/dev/mapper/slow-srv /srv ext4 rw,relatime,nobarrier,errors=remount-ro,stripe=384,data=ordered 0 0 - There does not appear to be any weird ACL on the directory; to be sure I did
setfacl -b objects. Even after doing so, chmod continued to not work. straceonchmodshows the syscall succeeding, and has the sgid bit set:fchmodat(AT_FDCWD, "annex", 02775) = 0- Other directories on the same filesystem have the set-group-id bit set. In fact, I set some earlier in the same session, in a different git-annex repository.