How does Sticky Bit work?
Presented by Vinothini
File Permission
We can view the file permission by ls command.
ls -l file.txt
-rw-r--r-- 1 user user 3 Feb 24 19:18 file.txt
Scenario I
What does happen if alice tries to create / modifies file in a bob directory?
Scenario II
How to solve this problem?
Set write permission to directory
Scenario III
Drawback:
Any user can accidently delete other user files as all user have full permission.
Scenario IV
Sticky bit
Sticky bit is always called as restricted deletion bit.
It prevents unprivileged users from removing or renaming a file in the directory unless
they own the file or directory.
We can set sticky bit by chmod +t <directory name> and remove it by chmod -t
<directory name>.
Where do we see sticky bit in our system?
Sticky bit is found on directory like /tmp.
/tmp directory has all the rights on all three levels. As the users have write permission on
this directory, they can delete or rename any file in this directory.
By enabling sticky bit, anyone can create a file/directory in /tmp, but it allows to delete or
rename users own file.
Thank You

Sticky bit

  • 1.
    How does StickyBit work? Presented by Vinothini
  • 2.
    File Permission We canview the file permission by ls command. ls -l file.txt -rw-r--r-- 1 user user 3 Feb 24 19:18 file.txt
  • 3.
    Scenario I What doeshappen if alice tries to create / modifies file in a bob directory?
  • 4.
    Scenario II How tosolve this problem? Set write permission to directory
  • 5.
    Scenario III Drawback: Any usercan accidently delete other user files as all user have full permission.
  • 6.
  • 7.
    Sticky bit Sticky bitis always called as restricted deletion bit. It prevents unprivileged users from removing or renaming a file in the directory unless they own the file or directory. We can set sticky bit by chmod +t <directory name> and remove it by chmod -t <directory name>.
  • 8.
    Where do wesee sticky bit in our system? Sticky bit is found on directory like /tmp. /tmp directory has all the rights on all three levels. As the users have write permission on this directory, they can delete or rename any file in this directory. By enabling sticky bit, anyone can create a file/directory in /tmp, but it allows to delete or rename users own file.
  • 9.