SGID Calculator
Calculate the resulting permission bits and behavior of setting the SGID bit on files or directories.
About SGID Calculator
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)
Worked example
With the default values below, SGID Calculator returns SGID Behavior of SGID set on directory — new files and subdirectories created inside automatically inherit this directory's group ownership, useful for shared team/collaboration directories.. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Full Octal Mode (e.g. 2775)accepts 0–7,777
- 2,775
- Applied Toone of Directory, File (executable)
- Directory
Results
- 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
- 1Values used
- 2SGID in octal notation
- 3SGID Behavior= SGID set on directory — new files and subdirectories created inside automatically inherit this directory's group ownership, useful for shared team/collaboration directories.
- 4Risk Level= Low (standard shared-directory pattern)
- 5SGID Bit Set?= Yes
Assumptions and limits
- The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
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.
