cancel
Showing results for 
Search instead for 
Did you mean: 
Trevor
Starfighter Starfighter
Starfighter
  • 70 Views

Prevent Removal/Deletion of Files

I've got a directory named  /tmp/dir1

The directory has the following information associated with it:

         drwxr-xrwx.  2   trev1  trev1   53   Mar 31  21:09

As you can see, the directory is owned by the user account "trev1", and is associated with the group "trev1".   Looking at information in the /etc/passwd file for the user account "trev1", the following appears:      trev1:x:1012:1013: :/home/trev1:/bin/bash

I have another user account, "trev2", that has the following information associated with it in the /etc/passwd file:     trev2:x:1020:1021: :/home/trev2:/bin/bash

When the user account "trev1" creates files in the /tmp/dir1 directory, the user account "trev2" can delete/remove those files.  That''s not acceptable!!!

How can I go about configuring something that will make it possible for each user account to be able to delete/remove ONLY the files that are created by that user account - "trev1" should be able to only delete files that are created by it, "trev2" should be able to only delete files created by it, etc.

This query is intended for the RHCSA-level audience - RHCAs, PhDs, and RHCEs are asked to kindly sit this one out

Trevor "Red Hat Evangelist" Chandler
1 Reply
Gopinath_Pigili
Flight Engineer
Flight Engineer
  • 28 Views

By setting sticky bit I think we can achieve this. the "sticky bit" numarical representation is 1 and  is a special permission flag that, when set on a directory, restricts file deletion or renaming to only the file owner, the directory owner, or the root user, even if other users have write permissions for the directory..!

Thanks

0 Kudos
Join the discussion
You must log in to join this conversation.