Monday 15 December 2014

How to : Delete files securely using shred from Nemo



The Linux command line tool shred is a fantastic way to securely remove files. It can be used from the command line e.g.

$ shred --force --remove --verbose --zero examplefile3
shred: examplefile3: removing
shred: examplefile3: renamed to 000000000000
shred: 000000000000: renamed to 00000000000
shred: 00000000000: renamed to 0000000000
shred: 0000000000: renamed to 000000000
shred: 000000000: renamed to 00000000
shred: 00000000: renamed to 0000000
shred: 0000000: renamed to 000000
shred: 000000: renamed to 00000
shred: 00000: renamed to 0000
shred: 0000: renamed to 000
shred: 000: renamed to 00
shred: 00: renamed to 0
shred: examplefile3: removed

Where

  • --force : change permissions to allow writing if necessary
  • --remove : truncate and remove file after overwriting
  • --verbose : show progress
  • --zero : add a final overwrite with zeros to hide shredding

The default is to overwrite the file 3 times but you can override this with –iterations=N, setting N to be the number of iterations.

Its useful to be able to quickly remove files securely using the File manager for Cinnamon Nemo. First its useful to review the Nemo Actions sample file :

$ vim /usr/share/nemo/actions/sample.nemo_action

Define the settings you require e.g.

$ cat /usr/share/nemo/actions/shred.nemo_action
[Nemo Action]
Name=Shred file
Comment=securely delete a file
Exec=/usr/bin/shred --force --remove --verbose --zero %F
Icon-Name=gtk-execute
Selection=S
Extensions=any;
Quote=double

  • Start nemo, right click on file and select 'Shred file'



    Note – Based on feedback I added 'Quote=double' which will delete files with spaces. 

1 comment:

  1. Small enhancement: if you add the "Quote=double" parameter at the end, the nemo shred action will also support file names with embedded spaces:

    [Nemo Action]
    Name=Shred file
    Comment=securely delete a file
    Exec=/usr/bin/shred --force --remove --verbose --zero %F
    Icon-Name=gtk-execute
    Selection=s
    Extensions=any;
    Quote=double

    ReplyDelete