Much to my immediate chagrin, removing write permission from a file does not seem to protect it from rm -f
:
touch foo
chmod a-w foo
rm -f foo
How 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.