Securely delete /home when it resides within the root filesystem

Here’s a way to obliterate everything in a sensitive directory if you do not have the luxury of wiping the entire disk device it resides on. It overwrites every file with random data and renames every file to a random name.


 for temp in `find /home/ -type f`; do SIZE=`du -k $temp | cut -f1`; \
    echo -n Obliterating $temp; FAILED=; dd if=/dev/urandom \
    of=$temp bs=1K count=$(($SIZE+1)) >/dev/null 2>/dev/null \
    || FAILED=1; if [ ! -z $FAILED ]; then echo ... failed; else \
    echo ... done; FNAME=`base64 /dev/urandom | tr -d '+/\r\n0-9' \
    | head -c 50`; mv $temp $FNAME;  fi  ; done

Leave a Reply