################################################## # $Id: mini-howto_trashcan-under-Linux_libtrash.pod,v 1.3 2003/01/27 09:21:51 jonen Exp $ # ################################################## # # $Log: mini-howto_trashcan-under-Linux_libtrash.pod,v $ # Revision 1.3 2003/01/27 09:21:51 jonen # + updated # # Revision 1.2 2003/01/25 09:06:51 jonen # + minor changes # # Revision 1.1 2003/01/25 08:43:21 jonen # + moved/convert to perlpod format # # # ################################################## =pod =head2 Implements a "trash can" under GNU/Linux with 'libtrash' Sebastian Utz S B Revision 1.2 2003/01/25 09:06:51 jonen + updated =head3 Description All stuff here is mainly copied from the libtrash doc. libtrash is a shared library which, when preloaded, implements a trash can under GNU/Linux. This way, your mistakes (at least those of the "rm -rf dir /" class :-)) will no longer cause the loss of a week's work or your system's binaries. =head4 install libtrash apt-get install libtrash or for those of you that aren't running Debian GNU/Linux: wget http://www.m-arriaga.net/software/libtrash/libtrash-latest.tgz tar xzf libtrash-latest.tgz cd libtrash-1.7/ edit Makefile for common settings make install (as root) =head4 test export LD_PRELOAD=/usr/lib/libtrash/libtrash.so rm -r =head4 enable libtrash at login Include this in your ~/.bash_profile(or for system-wide usage in /etc/profile) to enable libtrash every time you log in (or otherwise start a login shell) #-------------- snip --------------------------- LIBTRASH=/usr/lib/libtrash/libtrash.so LIBTRASH_dest=$LIBTRASH if test -L $LIBTRASH ; then LIBTRASH_dest="$(dirname $LIBTRASH)/$(ls -l "$LIBTRASH" | \ sed -e 's/^.\+ -> //')" fi if test x${LD_PRELOAD+set} = x -a -f "$LIBTRASH_dest" ; then LD_PRELOAD="$LIBTRASH" export LD_PRELOAD if test x$0 = x-bash ; then exec bash ${1+"$@"} else exec $0 ${1+"$@"} fi fi #-------------- end snip --------------------------- =head4 create user specify config - READ /etc/libtrash.conf !! - overwrite default values by setting up a ~/.libtrash for each user: # sample ~/.libtrash: #-------------- snip --------------------------- GLOBAL_PROTECTION = YES INTERCEPT_FOPEN = YES INTERCEPT_FREOPEN = YES INTERCEPT_OPEN = YES IGNORE_HIDDEN = NO IGNORE_EXTENSIONS= o;exe #-------------- end snip --------------------------- =head4 use 'cleanTrash' for cleaning Trash via cronjob - gunzip & copy '/usr/share/doc/libtrash/examples/cleanTrash/ct2.pl.gz' to '/usr/local/bin/cleanTrash' e.g: 'zcat /usr/share/doc/libtrash/examples/cleanTrash/ct2.pl.gz > /usr/local/bin/cleanTrash' - edit '/usr/local/bin/cleanTrash' for local configuration =head5 insert cronjob for root - crontab -e (as root) - insert: 3,13,23,33,43,53 * * * * root /usr/local/bin/cleanTrash =head3 Important Notes =over =item Gerneral READ /etc/libtrash.conf !! If libtrash.so is global enabled via /etc/profile, a DEFAULT or WRONG ~/.libtrash configuration would causes gdm, root writes(if root writes are also protected by lintrash), kde etc. stops working !! solution to disable libtrash in enviroment immediately: - export LD_PRELOAD="" =item XTerm to get a login shell, start XTerm with '-ls' (~/.profile will not be executed if not) =back =head3 Resources =over =item Libtrash - Implements a "trash can" under GNU/Linux http://www.m-arriaga.net/software/libtrash/ =back =cut