What is a sticky Bit and how to set it in Linux?

Today we will see how to set Sticky Bit in Linux. This is next to SGID in our ongoing File and Folder permissions series in Linux. We already discussed about CHMOD, UMASK, CHOWN, CHGRP, SGID and SUID file and folder permissions etc in our previous posts. In this post we will see

  • What is Sticky Bit?
  • Why we require Sticky Bit?
  • Where we are going to implement Sticky Bit?
  • How to implement Sticky Bit in Linux?

What is Sticky Bit?

Sticky Bit is mainly used on folders in order to avoid deletion of a folder and its content by other users though they having write permissions on the folder contents. If Sticky bit is enabled on a folder, the folder contents are deleted by only owner who created them and the root user. No one else can delete other users data in this folder(Where sticky bit is set). This is a security measure to avoid deletion of critical folders and their content(sub-folders and files), though other users have full permissions.

Learn Sticky Bit with examples:

Example: Create a project(A folder) where people will try to dump files for sharing, but they should not delete the files created by other users.

How can I setup Sticky Bit for a Folder?

Sticky Bit can be set in two ways

  1. Symbolic way (t,represents sticky bit)
  2. Numerical/octal way (1, Sticky Bit bit as value 1)

Use chmod command to set Sticky Bit on Folder: /opt/dump/

Symbolic way:

chmod o+t /opt/dump/
chmod +t /opt/dump/

Let me explain above command, We are setting Sticky Bit(+t) to folder /opt/dump by using chmod command.

Numerical way:

chmod 1757 /opt/dump/

Here in 1757, 1 indicates Sticky Bit set, 7 for full permissions for owner, 5 for read and execute permissions for group, and full permissions for others.

Checking if a folder is set with Sticky Bit or not?

Use ls –l to check if the x in others permissions field is replaced by t or T

For example: /opt/dump/ listing before and after Sticky Bit set

Before Sticky Bit set:

ls -l

total 8

-rwxr-xrwx 1 xyz xyzgroup 148 Dec 22 03:46 /opt/dump/

After Sticky Bit set:

ls -l

total 8

-rwxr-xrwt 1 xyz xyzgroup 148 Dec 22 03:46 /opt/dump/

Some FAQ’s related to Sticky Bit:

Now sticky bit is set, lets check if user “temp” can delete this folder which is created xyz user.

$ rm -rf /opt/dump

rm: cannot remove `/opt/dump': Operation not permitted

$ ls -l /opt

total 8

drwxrwxrwt 4 xyz xyzgroup 4096 2012-01-01 17:37 dump

if you observe other user is unable to delete the folder /opt/dump. And now content in this folder such as files and folders can be deleted by their respective owners who created them. No one can delete other users data in this folder though they have full permissions.

I am seeing “T” ie Capital s in the file permissions, what’s that?

After setting Sticky Bit to a file/folder, if you see ‘T’ in the file permission area that indicates the file/folder does not have executable permissions for all users on that particular file/folder.

Sticky bit without Executable permissions:

so if you want executable permissions, Apply executable permissions to the file.
chmod o+x /opt/dump/
ls -l command output:
-rwxr-xrwt 1 xyz xyzgroup 0 Dec 5 11:24 /opt/dump/
Sticky bit with Executable permissions:



sticky bit unix, unix sticky bit, suid, linux sticky bit, sticky bit in unix, sticky bit aix, sticky bit chmod, sticky bits, sticky bit linux, suid sgid sticky bit, set sticky bit, stickybit, sticky bit permission, setting sticky bit, solaris sticky bit, sticky bit solaris, sticky bit directory, remove sticky bit, ubuntu sticky bit, sticky bit t, aix sticky bit, sticky bit load balancer, directory sticky bit, umask

you should see a smaller ‘t’ in the executable permission position.

How can I find all the Sticky Bit set files in Linux/Unix.

find / -perm +1000

The above find command will check all the files which is set with Sticky Bit bit(1000).

Can I set Sticky Bit for files?

Yes, but most of the time it’s not required.

How can I remove Sticky Bit bit on a file/folder?

chmod o-t /opt/dump/

Post your thoughts on this.

Show your love by sharing this..!
Share on VKShare on StumbleUponShare on YummlyPrint this pageFlattr the authorShare on TumblrEmail this to someoneBuffer this pageShare on Google+Share on LinkedInShare on FacebookTweet about this on TwitterPin on PinterestShare on RedditDigg this
The following two tabs change content below.
My name is Surendra Kumar Anne. I hail from Vijayawada which is capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. I work with ICE systems, Sydney as Sr. Consultant. You can contact me at surendra (@) linuxnix dot com.
  • Sesha


  • http://www.linuxnix.com Surendra

    Thanks buddy..!

  • http://www.facebook.com/BalajeTruthKiller Balaje Babulu

    superb yar…

  • Pingback: Sticky bit intro « 0ddn1x: tricks with *nix()

  • Mahdskadmin

    Great site ever…thanks a lot

  • Biswajit_das261285


  • Shan Peng

    There is a small mistake in this article:
    Here in 1757, 1 indicates Sticky Bit set, 7 for full permissions for owner, 5 for write and execute permissions for group, and ful permissions for others. 

    I think ‘5 for read and execute permissions for group’ is right.

    • http://www.linuxnix.com Surendra

      update the post.. thanks for typo error..!

  • sri

    How to remove the sticky bit on folder?

    • http://www.linuxnix.com Surendra

      Its already mentioned Sri..
      How can I remove Sticky Bit bit on a file/folder?

      chmod o-t /opt/dump/

  • prabhat gupta

    faaaaaad bhai mast !!!!

  • Chintamani Bhagwat

    Its really good and easy to understand without any confusion..

  • roshan

    thank you so much sir….its very gud site for us …and very gud for system admin.

  • http://www.getyourlinux.blogspot.com SHISHIR

    I hv cleared my so much confusion here…


    Thanks,Nice Sharing

  • Farhaaz

    I really appriciate your explanation. Thank you very much.

  • amit sharma

    Thanks :)

  • anshoo

    Dear Surendra

    as per given data in your site it’s very usefull dear but one thing more i wanna discuss with u if we are running no AD in company and provide user to samba folder to all user in one authenticate user and password so how can we managed to all user to control.

    Example :- smb user name :-test password :-test
    and all user are access this folder with given name and password and they create own folder and delete one but other user also access same user name and password then he can also delete the same folder which is create on other user b,coz they are accessing same user name and password samba.

    How can we resloved this issue without giving more user name password .

  • http://www.tsheyangs.bt Tshering Dhendup

    What if the user has the sudo access? Can he delete the file which has sticky bit set??

  • chandmal gurjar

    The Sticky bit also called the saved text bit is the last permission bit remaining to be discus sed……..

  • shubham tomar

    thanks yaar to guide

    • http://www.linuxnix.com Surendra Anne

      Welcome Tomar.

  • https://www.facebook.com/harneet.singh.180072 ਹਰਨੀਤ ਸਿੰਘ

    But does STICKY BIT differentiate between a “SUDO USER” and the “ORIGINAL USER”
    For example : i am a user1 with sudo to user2
    /tmp/dump as a actual user2 user creates a file test
    then is user1 allowed to delete test file as user2 using sudo ???

  • Nilesh Singh

    Hi Surendra,

    This is Nilesh Singh from Mumbai.

    I have read your article on Google about the sticky bit which is being shared by you. It was really helpful information for me & very next week I am going to attend the interview for Linux administrator. I have been reading about the Linux from past few weeks but got stuck in some places like VI editing & LVM, as you are working as a Linux administrator so you may have some notes or documents for the same. It would be great help for me if you can provide these documents for the preparation.

    My mail id is [email protected]

    Thanks And Regards,
    Nilesh Singh.

  • anurag a

    hai sir,
    very good documentation and easy to understand….thank you so much

    i applied sticky bit in a single file created by user…but user cant edit this file…

  • Subramanian

    Thank you was really searching for this..

  • venkat


    at the time of applying sricky bit one default directory is created what is that directory..



  • Amod Mahajan

    Perfect explanation of Sticky bit.

  • http://www.udzial.com gaurav khurana

    Thanks for sucha nice explnataion covering all details from setting sticky bit to removing and the use of it

  • Doki


    If we set the stick bit for a file. Is it possible to modify the contents of the files by others.?




    • http://www.linuxnix.com Surendra Anne

      Yes, but they can not delete it.

  • Sunanda

    Hello Sir,

    I am new to Linux and whenever i face any dificulties, i refer to your documentation.

    Your documentation is very simplified and clear to be understood. 

    I sincerely thank you for such detailed and easy documentation. Very well done.




    Document is simplified very easy to understand. Thanks a lot!