What is safe-rm?
Safe-rm is a safety tool intended to prevent the accidental deletion of important files by replacing /bin/rm with a wrapper, which checks the given arguments against a configurable blacklist of files and directories that should never be removed.
Users who attempt to delete one of these protected files or directories will not be able to do so and will be shown a warning message instead:
$ rm -rf /usr Skipping /usr
(Protected paths can be set both at the site and user levels.)
Recovering important files you deleted by mistake can be quite hard. Protect yourself today by installing safe-rm and reduce the likelihood that you will need to contact a data recovery service!(Linux/UNIX source code).
safe-rm is all about preventing little disasters and part of this involves shipping a default set of paths to protect from deletion. I've tried to guess what would be useful to people, but it's very likely that I have a missed a number of critical paths that people care about.
So if you're happy with sharing your configuration, please consider emailing your /etc/safe-rm.conf or ~/.safe-rm to email@example.com.
Thanks to all of those who have reported problems on the Debian bug tracker!
Thanks to John Ferlito, who inadvertently deleted part of his /usr/lib, for this fix!
You can still use safe-rm to protect regular files and directories from accidental deletion using the rm command, but symbolic links will no longer be protected.
Another minor enhancement included in this release is the change in the message displayed by safe-rm when a protected file is skipped. The new message should now make it explicit who is to blame when a file isn't being deleted.
Minor improvements were also made to the documentation and overall code quality.
Many thanks to Dave Jones for his help in getting this release in shape.
The main change in this release is a fix for a bug that was preventing the root directory (/) from being added to the list of protected paths. Safe-rm is now able to protect you from the infamous rm -rf /.
I highly recommend that you now add / to your /etc/safe-rm.conf.
Thanks to Mubeen Jukaku for reporting this problem!
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 New Zealand License.