Showing posts with label sticky bit. Show all posts
Showing posts with label sticky bit. Show all posts

Tuesday, July 10

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

Sticky bits are mainly set on directories.
If you give 777 (full permission) to any directory then all users can delete,modify all files and directories so to avoid this we use sticky bit. by using it, all users can create and modify their own directories or files not others 
If the sticky bit is set for a directory, only the owner of that directory or the owner of a file can delete or rename a file within that directory.

The following two commands are used  to apply sticky bit on any directory  

chmod +t directory_name 
OR 
chmod 1777 directory_name