Chmod 2755 Explained
Chmod 2755 sets the SGID bit with standard directory permissions. New files inherit the directory's group. Essential for shared workspaces.
Permission
2755
rwxr-sr-x
chmod 2755 filename
Permission Breakdown
| Role | Read (4) | Write (2) | Execute (1) | Octal | Meaning |
|---|---|---|---|---|---|
| Owner | r | w | x | 7 | read, write, execute |
| Group | r | - | x | 5 | read, execute |
| Others | r | - | x | 5 | read, execute |
Visual Permission Grid
Detailed Explanation
The permission 2755 combines standard 755 permissions with the SGID (Set Group ID) bit, which has special behavior for directories.
Octal breakdown:
- 2 (Special): SGID bit set
- 7 (Owner): read (4) + write (2) + execute (1) = full access
- 5 (Group): read (4) + execute (1) = read and execute
- 5 (Others): read (4) + execute (1) = read and execute
In symbolic notation this is rwxr-sr-x. Note the s in the group execute position, indicating SGID is set.
When SGID is set on a directory, all new files and subdirectories created within it automatically inherit the directory's group ownership, rather than the creating user's primary group. This is extremely useful for shared project directories where you want all team members' files to have the same group, enabling consistent access control.
When SGID is set on an executable file, the program runs with the effective group ID of the file's group rather than the executing user's group, enabling controlled access to group-owned resources.
Use Case
Essential for shared project directories on multi-user systems. Used in /var/www setups where all files should be owned by the www-data group regardless of which developer created them.