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

Prevent file from being deleted

A file named "important" resides in the login directory of the user account
"trev1".   The file is owned by the user account "trev1".

The file named "important" has the following permissions:  -rwxrwxrwx

Without changing/modifying the permissions on this file, write the command
that will prevent this file from being deleted by the account "trev1", or "root".

Note:  All other files in the login directory of the user account "trev1"
              are able to be deleted!!!

 

Trevor "Red Hat Evangelist" Chandler
Labels (3)
2 Replies
  • 431 Views

Hi Trevor,

I would use the below command and make the the file to be immutable.

#chattr +i important

#lsattr important

Output

----i--------------- important

Trevor
Starfighter Starfighter
Starfighter
  • 406 Views

And Bader, that would definitely get the job done!!!

Great solution!!!

Trevor "Red Hat Evangelist" Chandler
Join the discussion
You must log in to join this conversation.