1

I know that the trashcan on Ubunutu Mate desktop performs a simple delete process, where one could theoretically recover the files after deletion. Is there an option to change that default functionality, and opt for using shred, or a shred like command to permanently delete files?

j0h
  • 15,365

1 Answers1

1

The simplest way to achieve this would probably be to watch the trash location (~/.local/share/Trash/Files I believe) for files, and use inotifywait to shred files when they arrive. inotifywait can be installed with sudo apt-get install inotify-tools

inotifywait -m ~/.local/share/Trash/Files -e moved_to -rq --format '%w%f' |
while read file; do
    shred $file
done

This snippet will shred any files as they appear in the trash folder. In addition you can use gvfs-trash --empty to empty the trash once the shred is complete, or you can ask shred to remove the file after overwriting, with shred -u.

(This answer was largely based on https://unix.stackexchange.com/questions/24952/script-to-monitor-folder-for-new-files and How do I get the filename from inotifywait events? which may provide some additional information)

vidarlo
  • 23,497