EXPLAIN: What is the ‘Sticky Bit’?
The ‘Sticky Bit’ is a permission bit that can be set on either a file or a directory.
If it is set on a file, then that file will remain in memory after execution, thus ’sticking’ in memory. This is useful when running a multi-user program (such as a bulletin board system that I ran once) to make the program execute faster for the next user. This was a common programming tactic earlier in the history of computer programming when speed and disk space were at a premium. Now that storage space and speeds are relatively good, there’s not much use for the sticky bit on a file today.
If the sticky bit is set on a directory, only the owner of files in that directory will be able to modify or delete files in that directory - even if the permissions set on those files would otherwise allow it. In my experimentation it looks like the root or superuser can still modify or delete files in a directory with the sticky bit set.
How do you set the sticky bit?
In a terminal window:
Put the number ‘1′ in front of a normal chmod command. Eg - to make the test file or directory world readable, writeable, executable, and sticky use chmod 1777 test.
In your desktop environment:
Right-click the test file or directory and go to properties. Look for a permissions tab or listing and check the sticky bit checkbox.
How can you tell if the sticky bit is set on a file or directory?
There will be a letter ‘t’ in the last position of the file permissions as in: -rwxrwxrwt 1 jon jon 1251 Oct 10 18:27 test
Related Stories
POSTED IN: Explanation
1 opinion for EXPLAIN: What is the ‘Sticky Bit’?
suvendu kumar mohapatra
Aug 7, 2008 at 11:58 pm
It has been illustrated in beautiful way.
Have an opinion? Leave a comment: