Linux tip of the day π§ π
So many people are either unaware of it or rarely use it.
In Linux, you can make a specific file or directory undeletable or immutable by using chattr command to set immutable flags on files:
$ sudo chattr +i -V /home/traw/keys.txt
-V option for verbose
Use the -R option with the chattr command to make a directory un-deletable. Here's how to make the /home/traw/backups directory un-deletable:
$ sudo chattr +i -VR /home/traw/backups
To make the file deleteable again, use -i, and to make a directory deleteable, use -i and the -R recursive option.
Follow me for more byte-sized Linux tips and be a better-informed Linux userπ§
Comments
Post a Comment