• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

COPYINGH A D03-Nov-201434.2 KiB677553

ChangesH A D03-Nov-20141.6 KiB5139

INSTALLH A D03-Nov-2014389 117

READMEH A D03-Nov-20142.5 KiB8053

safe-rmH A D03-May-20226 KiB22992

README

1safe-rm - https://launchpad.net/safe-rm
2prevention of accidental deletions using a directory blacklist
3
4Copyright (C) 2008-2014  Francois Marier <francois@fmarier.org>
5
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.
10
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.
15
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/>.
18
19How to use
20-----------
21
22Once you have installed safe-rm on your system (see INSTALL), you will need to
23fill the system-wide or user-specific blacklists with the paths that you'd like
24to protect against accidental deletion.
25
26The system-wide blacklist lives in /etc/safe-rm.conf and you should probably add
27paths like these:
28
29  /
30  /etc
31  /usr
32  /usr/lib
33  /var
34
35The user-specific blacklist lives in ~/.config/safe-rm and could include things like:
36
37  /home/username/documents
38  /home/username/documents/*
39  /home/username/.mozilla
40
41
42Other approaches
43-----------------
44
45If you want more protection than what safe-rm can offer, here are a few suggestions.
46
47You could of couse request confirmation everytime you delete a file by putting this in
48your /etc/bash.bashrc:
49
50  alias rm='rm -i'
51
52But this won't protect you from getting used to always saying yes, or from accidently
53using 'rm -rf'.
54
55Or you could make use of the Linux filesystem "immutable" attribute by marking (as root)
56each file you want to protect:
57
58  chattr +i file
59
60Of course this is only usable on filesystems which support this feature.
61
62Here are two projects which allow you to recover recently deleted files by trapping
63all unlink(), rename() and open() system calls through the LD_PRELOAD facility:
64
65  delsafe
66  http://homepage.esoterica.pt/~nx0yew/delsafe/
67
68  libtrashcan
69  http://hpux.connect.org.uk/hppd/hpux/Development/Libraries/libtrash-0.2/readme.html
70
71There are also projects which implement the FreeDesktop.org trashcan spec. For example:
72
73  trash-cli
74  http://code.google.com/p/trash-cli/
75
76Finally, this project is a fork of GNU coreutils and adds features similar to safe-rm
77to the rm command directly:
78
79  http://wiki.github.com/d5h/rmfd/
80