setgid
also: set group ID, SGID
A special file permission bit that causes an executable to run with the group privileges of the file's owner rather than the user executing it. On directories, it ensures new files inherit the directory's group.
setgid (set group ID) is a permission mode that changes how executables and directories behave. When set on a binary file, any user running that program temporarily assumes the group ownership of the file itself, not their own group.
For example, if a file is owned by group wheel with setgid enabled, a regular user executing it will have wheel group permissions during execution. This allows programs to access resources restricted to specific groups.
On directories, setgid ensures that all new files created inside inherit the directory's group rather than the creator's primary group. This is useful for shared project directories where team members need consistent group ownership.
Set setgid with chmod g+s filename or chmod 2755 filename (where the leading 2 represents setgid). It appears as an s in the group execute position when listing permissions: -rwxr-sr-x.