whatis sticky-bit
Sticky Bit
A directory permission bit that lets users delete only their own files, even when everyone has write access, as on /tmp.
What Is the Sticky Bit in Linux?
Without the sticky bit, write permission on a directory lets you delete any file in it. With it set, only the file owner, the directory owner, or root can remove or rename entries.
/tmp is the classic example, shown as drwxrwxrwt. Set it with chmod +t dir or the leading octal digit 1, as in chmod 1777.
Example
ls -ld /tmp
# drwxrwxrwt 18 root root 4096 /tmp Learn more about Sticky Bit
- The Sticky Bit Explained The sticky bit restricts file deletion in shared, world-writable directories so only the file owner can remove their own files. This guide explains how it works, where it is used by default, and how to set it.
- The /tmp Directory Explained /tmp is Linux's designated scratch space for temporary files, often cleared on every reboot. This guide explains how /tmp works, why it is sometimes stored in RAM, and how it differs from /var/tmp.