Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
j0n4s53101yhttps://man.archlinux.org/man/...
`chattr +i` makes a file immutable -> can't be changed or deleted
This only makes sense on static files though and would need to be set on every file you want to protect.
Though someone with root still can do `chattr -i` (remove immutable flag) on the files and then delete them -
j0n4s53101y
-
Network mount a folder. It's always annoying when sudo rm doesn't work and I realize that the file is not local.
-
j0n4s53101yYou could also put the directory elsewhere and bind-mount it read ony
# sudo mount --read-only --bind /your/current/directory /your/new/mount/point
# rm -rf /your/new/mount/point
rm: cannot remove /your/new/mount/point/file1: Read-only file system
rm: cannot remove /your/new/mount/point/file2: Read-only file system
...
Guys,
is it possible to protect a folder against the command sudo rm -rf
Consider the root a drunk person on a high speed road
question