Linux 101 : The sticky bit - protecting directories -



The permissions for a directory in Linux system are as below:


When we create a directory as demonstrated in the below example, and we can give everybody in the "group_1" the right to write to it:


The members of the group "group_1" could create new files, but they could also delete existing files, including the ones belonging to the other members of the group.

To keep that from happening we assign the "sticky bit" to the directory "/home/test", so that the members of the group "
group_1" can add files, but they can only delete the files they own.

Only the the owner of the directory and the root user could delete any file they want inside that directory.

We set the "sticky bit" using the below command:


An example of a "sticky bit" directory, would be the "/tmp" directory as we can see below:


Comments

Leave as a comment:

Archive