fir3net
PPS-Firenetbanner-780.5x190-30-03-17

UNIX - What is a sticky bit ?

History

The sticky bit was first introduced in 1974 within the UNIX operating system. Its purpose was to instruct the operating system to place the process into swap once completed. Thus reducing the startup time of the process during further executions. However nowdays this usage is obsolete.

Usage

Instead, the sticky bit is now set on a directory. With the intention to limit only the directory owner, the item owner or root to rename or delete any child items.
The sticky bit is represented by either a 't' or 'T' and is displayed within the execute permission section for 'others'.

[root@server ~]# ls -ld /tmp
drwxrwxrwt 11 root root 4096 Oct 24 22:09 /tmp

Difference between T`s

So you may be asking. What is the difference between 't' and 'T' ?
A lowercase 't' represents the "x" being unset, whereas 'T' represents the 'x' being unset.

-rwxrwxrwt - sticky bit and others execute bit set
-rwxrwxr-T - sticky bit is set and others execute bit is not set

Configuration

To configure sticky on a directory the following command is used.

[root@server ~]# chmod +t /tmp/test/

[root@server ~]# ls -ld /tmp/test/
drwxrwxrwt 11 root root 4096 Oct 24 22:09 /tmp/test

Tags: UNIX

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001