Small improvements to the code after running Perl::Critic
[safe-rm.git] / README
blob68c36b5a44e2a67c713a7b6f0d59f207eb01abe0
1 safe-rm - http://www.safe-rm.org.nz
2 prevention of accidental deletions using a directory blacklist
4 Copyright (C) 2008  Francois Marier <francois@debian.org>
6    This program is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation, either version 3 of the License, or
9    (at your option) any later version.
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 How to use
20 -----------
22 Once you have installed safe-rm on your system (see INSTALL), you will need to
23 fill the system-wide or user-specific blacklists with the paths that you'd like
24 to protect against accidental deletion.
26 The system-wide blacklist lives in /etc/safe-rm.conf and you should probably add
27 paths like these:
29   /
30   /etc
31   /usr
32   /usr/lib
33   /var
35 The user-specific blacklist lives in ~/.safe-rm and could include things like:
37   /home/username/documents
38   /home/username/.mozilla
41 Other approaches
42 -----------------
44 If you want more protection than what safe-rm can offer, here are a few suggestions.
46 You could of couse request confirmation everytime you delete a file by putting this in
47 your /etc/bash.bashrc:
49   alias rm='rm -i'
51 But this won't protect you from getting used to always saying yes, or from accidently
52 using 'rm -rf'.
54 Or you could make use of the Linux filesystem "immutable" attribute by marking (as root)
55 each file you want to protect:
57   chattr +i file
59 Of course this is only usable on filesystems which support this feature.
61 Here are two projects which allow you to recover recently deleted files by trapping
62 all unlink(), rename() and open() system calls through the LD_PRELOAD facility:
64   delsafe
65   http://homepage.esoterica.pt/~nx0yew/delsafe/
67   libtrashcan
68   http://hpux.connect.org.uk/hppd/hpux/Development/Libraries/libtrash-0.2/readme.html