Securely empty linux trash can

You can thank the user testingresults over on the Kali forums for this one. That link will take you to his guide, which is much better than what I have.

Very quick reproduction of the guide follows.

apt-get install scrub
vim empty_trash.sh

#!/bin/bash

find ~/.local/share/Trash/files ~/.local/share/Trash/info -type f -print0 | xargs -0 -I{} /usr/bin/scrub -Sfp random {}

find ~/.local/share/Trash/files/* ~/.local/share/Trash/info/* -depth | while read i
do
    cleant=$(head -c17 /dev/urandom | tr -d [[:space:]] | tr -d [[:punct:]])
    mv "$i" ~/.local/share/Trash/files/"$cleant" 2> /dev/null
done

rm -rf ~/.local/share/Trash/files/*

chmod +x empty_trash.sh

Then run it whenever you need to empty the trash.

BBK

BBK

Infosec analyst, lover of passwords, and owner of a giant goofy puppy.

Read More
Securely empty linux trash can
Share this