3 prevention of accidental deletions by excluding important directories
5 Copyright (C) 2008-2020 Francois Marier <francois@fmarier.org>
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <https://www.gnu.org/licenses/>.
22 Once you have installed safe-rm on your system (see `INSTALL`), you will need to
23 fill the system-wide or user-specific exclusions with the paths that you'd like
24 to protect against accidental deletion.
26 The system-wide exclusions live in `/etc/safe-rm.conf` (or `/usr/local/etc/safe-rm.conf`)
27 and you should probably add paths like these:
35 The user-specific exclusions live in ~/.config/safe-rm and could include things like:
37 /home/username/documents
38 /home/username/documents/*
39 /home/username/.mozilla
43 If you want more protection than what safe-rm can offer, here are a few suggestions.
45 You could of couse request confirmation everytime you delete a file by putting this in
46 your /etc/bash.bashrc:
50 But this won't protect you from getting used to always saying yes, or from accidently
53 Or you could make use of the Linux filesystem "immutable" attribute by marking (as root)
54 each file you want to protect:
58 Of course this is only usable on filesystems which support this feature.
60 Here are two projects which allow you to recover recently deleted files by trapping
61 all unlink(), rename() and open() system calls through the LD_PRELOAD facility:
63 * [delsafe](https://web.archive.org/web/20081027033142/http://homepage.esoterica.pt:80/~nx0yew/delsafe/)
64 * [libtrashcan](http://hpux.connect.org.uk/hppd/hpux/Development/Libraries/libtrash-0.2/readme.html)
66 There are also projects which implement the FreeDesktop.org trashcan spec. For example:
68 * [trash-cli](https://github.com/andreafrancia/trash-cli)
70 Finally, this project is a fork of GNU coreutils and adds features similar to safe-rm
71 to the rm command directly:
73 * [rmfd](https://github.com/d5h/rmfd)