[lug] Safe file-deletion programs

socket at peakpeak.com socket at peakpeak.com
Fri Jan 14 02:17:54 MST 2000


I just remembered a posting from a week ago or so of someone asking
for a safe way to prevent accidentally deleting files, but I forget
who it was.  I dug through "Unix Power Tools" and found the program on
the CD.  I've mirrored it on my website temporarily (if you want a
copy of it, you might want to get it sometime in the next week or so)
at the following address:

http://www.peakpeak.com/~socket/delete.tar.gz

This contains two directories, bin/ and man/... copy the programs in
bin/ to /usr/local/bin, the files in man/man1/ to /usr/local/man/man1
(or wherever you find it appropriate to install them on your system)
and have a look at it.

To see if this is something you want to use, I'll quote the advantages
and disadvantages verbatim from the book here:

--------------------------------------------------------------

Advantages:

- It works on any filesystem type-- local, NFS, AFS, RFS, whatever.
You don't have to have special daemons running on your file servers in
order for it to work, and there are no daemons to go down and prevent
deleted file archiving from taking place.

- It maintains the directory locations in which deleted files are
stored so that they can be undeleted in the same locations.

- It maintains file permissions and ownership so that undeleted files
can be restored with them.  Furthermore, deleted files can be
undeleted by anyone who had permission to delete them in the first
place, not just by the one individual who deleted them.

Disadvantages:

- Deleted files are counted against a user's disk quota until they are
actually permanently removed (either by the system, a few days after
they are deleted, or by the user with the 'expunge' command that is
part of the 'delete' package).  Some people would actually call this
an advantage, because it prevents people from using deleted files to
store large files (something which is possible with 'entomb').

- Deleted files show up when a user does 'ls -a'.  This is considered
a relatively minor disadvantage by most people, especially since files
starting with a dot (.) are supposed to be hidden most of the time.

- Deleted files have to be searched for in filesystem trees in order
to expunge them, rather than all residing in one location as they do
with 'entomb'.  This, too, is usually considered a minor disadvantage,
since most systems already search the entire filesystem each night
automatically in order to delete certain temporary files.

- Only the 'entomb' program protects files. A user can still blow away
a file with 'mv', 'cat a b > a', etc.  If your main concern is
eliminating accidental file deletions with rm, this isn't much of a
problem, furthermore, it is not clear that the extra overhead required
to run something like 'entomb' is worth the advantage gained (even if
it is possible to do what 'entomb' needs at your site)

--------------------------------------------------------------

I didn't write this, and I haven't tried it. (I learned my lesson with
something resembling rm -rf /usr as root on an old slackware system.)
As usual, YMMV.

--
Chris Riddoch                  socket at peakpeak.com
Will provide pseudo-insightful commentary for food
                   http://www.peakpeak.com/~socket

GPG key 1024D/234551DC 1999-07-15 Chris Riddoch <socket at peakpeak.com>
Key fingerprint = 7AAF 5815 837C 070C 6C70  8A15 EFD2 5860 2345 51DC




More information about the LUG mailing list