Linux Security — Sticky Bit

Shlomi Boutnaru, Ph.D.
1 min readSep 23, 2022

--

Beside the ordinary permissions that a file/directory can have in Linux (read, write & execute) we can also assign specific permissions bits that have a special meaning: suid, sgid and sticky bit. The first two are going to be covered on a different writeups, on this one I am going to focus on “sticky bit”.

Have you ever asked yourself what the “t” in the output of “ls -l” stands for? (as you can see in the screenshot below taken from copy.sh). As you can see everyone can read and write to “/tmp”, but in the place of “execute” there is a “t” (and not an “x”) — it means “sticky bit”.

The goal of “sticky bit” when setting it on a directory is to allow the removal of files in the directory only by their owner. You can see a full demonstration of that in the image below. As shown even if the file (/tmp/test1_file) has full permissions for everyone it still can’t be deleted by the user test2 (by the way the permissions of the file are not relevant as we will show in a different writeup).

See you in my next writeup ;-)

You can follow me on twitter — @boutnaru (https://twitter.com/boutnaru).

--

--