Quick Answer: How Do I Prevent a File Being Deleted in Linux?
Contents in Linux We Can Set the Immutable Flag on a File or Directory with the ‘Chattr’ Command. Once Immutable, It Will Not Be Possible to Delete, Modify, or...
Contents
In Linux we can set the immutable flag on a file or directory with the ‘chattr’ command. Once immutable, it will not be possible to delete, modify, or rename the file or directory that it has been applied to.
How do I protect a file from deletion in Linux?
I know an useful commandline utility called “chattr” that is used to prevent files and folders from accidental deletion or modification in Linux. Chattr, short for Change Attribute, applies/removes certain attributes to a file or folder in your Linux system.
How do I protect a file from being deleted?
Prevent Files From Being Renamed And Deleted By Hiding Files
- Right-click on your file and select Properties.
- You’ll be in the General tab by default. At the bottom of your screen, you’ll find an option saying Hidden. Tick-mark the option and click on OK.