Purpose of setgid Directory in Linux/Unix

linuxposixsetgidunix

I know how setgid works, but I don't know why it is designed, is there any example to illustrate what problems it solves?

Best Answer

While a setgid file/binary might not be obviously useful I definitely find the setgid bit very useful applied on directories. Assuming you are parts of different working groups, which each has their own unix (permission) groups. Surely you would then want to put the setgid bit on project folders, making sure that the right group ownership is applied when you create new files, and thereby allowing your colleagues in that project group access to those files?