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?

2
  • 1
    Do you want to shred files on emptying the trashcan, or do you want to shred files instead of putting them into trash?
    – Byte Commander
    Feb 4, 2018 at 14:42
  • Shred when emptying seems preferable.
    – j0h
    Feb 12, 2018 at 21:20

1 Answer 1

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)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .