What Does Sticky Bit Do in Linux?
Contents a Sticky Bit Is a Permission Bit That Is Set on a File or a Directory That Lets Only the Owner of the File/Directory or the Root User to Delete or...
A Sticky bit is a permission bit that is set on a file or a directory that lets only the owner of the file/directory or the root user to delete or rename the file. No other user is given privileges to delete the file created by some other user.
Why we use sticky bit in Linux?
Usage. The most common use of the sticky bit is on directories residing within filesystems for Unix-like operating systems. 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.
Must Read
How do you use a sticky bit?
Set the sticky bit on Directory
Use chmod command to set the sticky bit. If you are using the octal numbers in chmod, give 1 before you specify other numbered privileges, as shown below. The example below, gives rwx permission to user, group and others (and also adds the sticky bit to the directory).