What is setgid?

Mode 2000

#chmod g+s /home/share Sets the SGID flag

#chmod 2755 file Sets the SGID flag

#chmod g-s /home/share Removes the SgID flag

#chmod 2770 /home/share drwxrwsrwx root root share

When a file is created in a directory, normally it belongs to the primary group of the user that created the file.

But if the setgid bit is set on the directory, now new files created have their group ownership set to the same group as the owner of the directory.

This allows 1 level of access to group members while allowing different level of access to non group members.