Linux 在 CentOS 上永久安全地删除文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10377393/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 06:05:15  来源:igfitidea点击:

Deleting Files Permanently and Securely on CentOS

linuxsecurityfilesystemscentos

提问by user1260776

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

我想知道如何在 CentOS 上永久安全地删除文件。我现在遇到的问题是,文件系统是 ext3,当我想到使用srm-它时说的是

"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."

“它应该适用于 ext2、基于 FAT 的文件系统和 BSDnative 文件系统。Ext3 用户应该特别小心,因为它也可以设置为日志数据,这是重建信息的明显途径。”

If I can't use shredor 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.

如果我不能使用shredor srm,并且安全删除也不是一个选项,那么我对如何安全和永久地删除数据一无所知。我要删除的文件没有加密。

采纳答案by K1773R

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!

这将首先用随机数据覆盖给定的文件,然后用 0x00(零)覆盖给定的文件,然后它将删除文件;) 粉碎快乐!

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:

请注意,ext3/ext4(以及所有日志文件系统)可以使用随机数据和零来缓冲碎片,并且只会将零写入磁盘,当您有一个小文件时就是这种情况。对于一个小文件,使用这个:

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).

对于 ext3 1MB 或更大应该足以写入磁盘(但我不确定,自从我使用 ext3 以来已经很长时间了!),对于 ext4 有一个巨大的缓冲区(最多半个演出或更多/更少)。

回答by jjlin

The srmreadme says only that Ext3 users should be especially careful, not that srmdefinitely won't work on Ext3.

srm自述只说Ext3的用户要特别小心,不是说srm绝对不会对Ext3的工作。

In particular, Ext3 does not enable data journaling by default, so in theory, srmshould work basically to the extent that it was designed to work. You may want to take a look at this linkfor a good overview of the basic issues.

特别是,Ext3 在默认情况下不启用数据日志,因此理论上,srm应该基本上可以在其设计工作的范围内工作。您可能需要查看此链接,以全面了解基本问题。