Chmod 1777 Explained
Chmod 1777 sets the sticky bit with full access. The classic /tmp directory permission. Only file owners can delete their own files.
Permission
1777
rwxrwxrwt
chmod 1777 filename
Permission Breakdown
| Role | Read (4) | Write (2) | Execute (1) | Octal | Meaning |
|---|---|---|---|---|---|
| Owner | r | w | x | 7 | read, write, execute |
| Group | r | w | x | 7 | read, write, execute |
| Others | r | w | x | 7 | read, write, execute |
Visual Permission Grid
Detailed Explanation
The permission 1777 grants full access to everyone (like 777) but adds the sticky bit, which restricts file deletion within a directory.
Octal breakdown:
- 1 (Special): sticky bit set
- 7 (Owner): read (4) + write (2) + execute (1) = full access
- 7 (Group): read (4) + write (2) + execute (1) = full access
- 7 (Others): read (4) + write (2) + execute (1) = full access
In symbolic notation this is rwxrwxrwt. Note the lowercase t in the final position, which indicates the sticky bit is set and the execute bit for others is also set. If the execute bit were not set, it would show as uppercase T.
The sticky bit on a directory means that only the file owner, the directory owner, or root can delete or rename files within that directory, even though everyone has write access. This is the standard permission for the /tmp directory on virtually all Unix systems. Without the sticky bit, any user with write access to the directory could delete any other user's files.
Use Case
The standard permission for /tmp and /var/tmp directories on Unix/Linux systems. Also used for any shared writable directory where users should only manage their own files.