In this post discussing one special permission on the directory which is called a sticky bit. This special permission effect on the directory is users with write access can be removed or renamed .which is owned by their owners. the user cannot remove or force save the files owned by other users. This sticky bit permission has no effect on the files.
The example of the sticky bit can be seen in the permission of the /tmp directory. In the tmp directory, users can copy their files but no one else can remove those files instead of that owners. The below image is showing permission on the tmp directory.
In place of other users, permission the small t in execute bit. without a sticky bit, every user can remove everyone else’s files in /tmp directory because write permission has been already granted to all users on that directory.
Here I am going to show below the practical aspect. I am going to create one directory and giving full permission to the user group and others mean everyone can create files or directories and do a modification and also can remove other user files and directories inside that directory.
In the above screencast, I created a directory secure server and created two users user1 and user2. user1 created a file inside that directory /secureserver . User2 delete that testfile_u1, which is owned by user1.
Afet Sticky bit implementation
# chmod o + t directory_pathOR
# chmod 2777 directory_path
After sticky bit implementation, the users can not delete other users’ files. The error produces if a user tries to delete another user file, it says “Operation not permitted “.
Hope you understand the uses this concept . comment below if you have any query ?