How to sets a special restriction on the deletion of files | Sticky bit

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 permission has no effect on the files.

The example of the can be seen in the permission of the / 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 / 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 implementation

So in the next steps, I am going to implement special permission on others that are . Command to use set the on the directory is below through number and letter format below.

 # chmod o + t  directory_path 
 # chmod 2777 directory_path 

After implementation, the users can not delete other users’ files. The 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 ?

About Sachin Gupta

I am a professional freelance contributor and founder of tech transit. Love to write and lover of education, culture, and community. I have been using it, setting, supporting, and maintaining it since 2009.Linux rocks!

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *