Sticky Bit - noyage/redhat GitHub Wiki
- When a directory's sticky bit is set, the filesystem treats the files in such directories in a special way so only the file's owner, the directory's owner, or
root
, can rename or delete the file. - Without the sticky bit set, any user with write and execute permissions for the directory can rename or delete contained files, regardless of the file's owner.
- Typically, this is set on the
/tmp
to prevent ordinary users from deleting or moving other users' files. This feature was introduced in 4.3BSD in 1986, and today it is found in most modern Unix-like systems.
$ chmod 1777 mydir
$ ls -ld mydir
drwxrwxrwt 4 root sys 485 Nov 10 06:01 mydir
The Linux kernel ignores the sticky bit on files.