Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting Files Permanently and Securely on CentOS

I would like to know how would to permanently and securely delete files on CentOS. The problem I'm having right now is that, the filesystem is ext3, and when I thought of using srm- it said something like

"It should work on ext2, FAT-based file systems, and the BSDnative file system. Ext3 users should be especially careful as it can be set to journal data as well, which is an obvious route to reconstructing information."

If I can't use shred or srm, and secure-delete is also not an option, I'm clueless about how to securely and permanently delete the data. The files I'm deleting are NOT encrypted.

like image 960
user1260776 Avatar asked Apr 30 '12 01:04

user1260776


People also ask

How do you securely delete a file in Linux?

Method 2: Secure-Delete: Secure-delete is a command containing a set of secure file deletion tools containing srm (secure_deletion) tool which is used to delete or overwrite the files securely in Linux. srm : It is a secure rm that is used to erase files by overwriting their hard disk space and deleting them.

How do I delete everything on Centos 7?

Type the command rm –r dir1 , it will ask a confirmation to descend to all the available objects in dir1 and to remove them type y for YES and press enter. Use the command rm –f to delete without terminal asking for a confirmation.

Does rm remove permanently?

From a normal user's point of view, yes, a file deleted with the rm command is deleted permanently. Unlike Windows system or Linux desktop environment where a deleted file is moved in Recycle Bin or Trash folder respectively, a file deleted with the rm command is not moved in any folder. It is deleted permanently.


1 Answers

just use shred:

shred -v -n 1 -z -u /path/to/your/file

this will shred the given file by overwriting it first with random data and then with 0x00 (zeros), afterwards it will remove the file ;) happy shreding!

notice that ext3/ext4 (and all journaling FS) could buffer the shred with random data and zeros and will only wirte the zeros to disk, this would be the case when you have a little file. for a little file use this:

shred -v -n 1 /path/to/your/file #overwriting with random data
sync #forcing a sync of the buffers to the disk
shred -v -n 0 -z -u /path/to/your/file #overwriting with zeroes and remove the file

for ext3 1MB or greater should be enough to write to the disk (but im not sure on that, its a long time since i used ext3!), for ext4 theres a huge buffer (up to half a gig or more/less).

like image 92
K1773R Avatar answered Oct 14 '22 14:10

K1773R