3

How do I securely delete a folder, with all of its contents, so it cannot be recovered?

I have tried the shred command but it only works with files and not folders.

I have also found out that there is a package called secure-delete which seems to work fine on Ubuntu, but when I try to install it using sudo yum install secure-delete I get the following message: No package secure-delete available which makes me think that the package is not available for CentOS 7.

How to proceed?

2
find /folder -type f | xargs shred

but underlying layers (like a COW FS, or SSD wear leveling) might make that pointless, so it's best to just encrypt in the first place.

  • The storage device may also move blocks around (as well as the file-system). No guarantee of deletion. – ctrl-alt-delor Feb 20 '18 at 17:00
  • @ctrl-alt-delor yes I already mentioned "cow fs", and added "wear leveling" just now. – user1133275 Feb 21 '18 at 15:29
  • Also, if there is any chance that the files may have been copied around on the system, they would have left traces in other places too. – Kusalananda Feb 21 '18 at 15:39
  • @Kusalananda that seems obvious but for people not already understanding this question maybe not, but anyway encryption solves that to. Other ideas in that vain are use encrypted transports (https), otherwise proxy servers will copy your file. – user1133275 Feb 21 '18 at 20:02
0

My suggestion would be to get the application source and compile/install it yourself manually.

0

On non-journalled file systems, shred can securely delete files for you. Just make sure you apply it individually to each file, e.g. using the find command shown in user1133275's answer.

However most file systems today are journalled (NTFS, ext3/4, reiserfs, jfs, xfs, btrfs, zfs [in a way]) so you may not be able to effectively delete all traces of that data using shred or anything else. Only time will ensure that the blocks will eventually get reused and the journal rotated enough that the data disappeared.

Your other option is to shred the entire partition using an appropriate tool. Depending on how far you need to go, overwriting the partition with data from /dev/urandom could be sufficient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.