Sign the git tags
[safe-rm.git] / README
blob91ae928ea77ee0ebb8ff7bc7bf585baa96928f2f
1 safe-rm - https://launchpad.net/safe-rm
2 prevention of accidental deletions using a directory blacklist
4 Copyright (C) 2008-2014  Francois Marier <francois@fmarier.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 ~/.config/safe-rm and could include things like:
37   /home/username/documents
38   /home/username/documents/*
39   /home/username/.mozilla
42 Other approaches
43 -----------------
45 If you want more protection than what safe-rm can offer, here are a few suggestions.
47 You could of couse request confirmation everytime you delete a file by putting this in
48 your /etc/bash.bashrc:
50   alias rm='rm -i'
52 But this won't protect you from getting used to always saying yes, or from accidently
53 using 'rm -rf'.
55 Or you could make use of the Linux filesystem "immutable" attribute by marking (as root)
56 each file you want to protect:
58   chattr +i file
60 Of course this is only usable on filesystems which support this feature.
62 Here are two projects which allow you to recover recently deleted files by trapping
63 all unlink(), rename() and open() system calls through the LD_PRELOAD facility:
65   delsafe
66   http://homepage.esoterica.pt/~nx0yew/delsafe/
68   libtrashcan
69   http://hpux.connect.org.uk/hppd/hpux/Development/Libraries/libtrash-0.2/readme.html
71 There are also projects which implement the FreeDesktop.org trashcan spec. For example:
73   trash-cli
74   http://code.google.com/p/trash-cli/
76 Finally, this project is a fork of GNU coreutils and adds features similar to safe-rm
77 to the rm command directly:
79   http://wiki.github.com/d5h/rmfd/