Much to my immediate chagrin, removing write permission from a file does not seem to protect it from rm -f:touch foochmod a-w foorm -f fooHow can I protect a file from accidental deletion when rm will be called with the -f flag? It looks like chattr +i foo would work, but it requires root on my system (is that intended?), so I'm looking for a non-root solution.
Protect files from `rm -f`
permissions;rm
To prevent files from being added or deleted to a directory, you can to remove the write permission for the directory.