SGID Calculator
Interpret the SGID permission bit (2000) on files vs. directories.
Inputs
SGID Behavior
SGID set on directory — new files and subdirectories created inside automatically inherit this directory's group ownership, useful for shared team/collaboration directories.
Risk Level
Low (standard shared-directory pattern)
SGID Bit Set?
true
Step by step
Values used
Full Octal Mode (e.g. 2775) = 2,775; Applied To = Directory
SGID in octal notation
2000 = SGID bit; full mode = 2000 + owner/group/other permission bits (e.g. 2775)
SGID Behavior
= SGID set on directory — new files and subdirectories created inside automatically inherit this directory's group ownership, useful for shared team/collaboration directories.
Risk Level
= Low (standard shared-directory pattern)
SGID Bit Set?
= Yes
How it works
The SGID (Set Group ID) bit, 2000 in octal special-permissions notation, behaves differently depending on what it's applied to: on a directory, it makes every new file and subdirectory created within automatically inherit the parent directory's group ownership rather than the creating user's primary group — the standard mechanism for shared team directories where multiple users need consistent group-level access to files others create. On an executable file, it works like SUID but for group privileges: the process runs with the file's group ownership rather than the invoking user's group, a less common pattern than directory SGID but still used by some system tools (e.g. `wall`, `write` historically use group-based SGID for tty access).
Formula
SGID in octal notation
2000 = SGID bit; full mode = 2000 + owner/group/other permission bits (e.g. 2775)
Frequently Asked Questions
How do I set up a shared directory using SGID?
`chmod g+s /shared/dir` (or `chmod 2775 /shared/dir`) combined with setting the directory's group ownership (`chown :teamgroup /shared/dir`) ensures every file subsequently created inside inherits the teamgroup group, keeping collaborative access consistent without users needing to manually chgrp every new file.
How do I find all SGID files/directories on a system?
`find / -perm -2000 2>/dev/null` lists every file or directory with the SGID bit set — combine with `-type d` or `-type f` to filter specifically for directories or files.
Is SGID on a directory recursive to subdirectories automatically?
No — SGID must be set explicitly on each directory where inheritance is wanted; new subdirectories created inside an SGID directory do inherit the SGID bit itself (so the behavior propagates), but pre-existing subdirectories created before SGID was set do not retroactively gain it.