CW *_* II 17 linux filesystems security openvms rm
在 VMS 中,当文件被删除时,可以告诉文件系统在文件的现有内容上写入垃圾。这是用于识别此类处理的文件的 DCL 命令:
$ SET FILE/ERASE_ON_DELETE SAMPLE.TXT
Run Code Online (Sandbox Code Playgroud)
这允许在某个时间点设置策略,然后文件的后续用户不必处理安全细节。将文件名从目录中取出并释放空间供另一个文件使用的标准删除也会修改现有内容以防止下一个用户读取它。正常删除:
$ DELETE SAMPLE.TXT.*
Run Code Online (Sandbox Code Playgroud)
什么是Linux?
小智 19
这仅受某些 Linux 文件系统支持:
chattr +s sample.txt
Run Code Online (Sandbox Code Playgroud)
可能(或可能不)做你想做的事。
来自man chattr
:
NAME
chattr - change file attributes on a Linux second extended file system
...
When a file with the ‘s’ attribute set is deleted, its blocks are
zeroed and written back to the disk. Note: please make sure to read
the bugs and limitations section at the end of this document.
...
BUGS AND LIMITATIONS
The ‘c’, ’s’, and ‘u’ attributes are not honored by the ext2
and ext3 filesystems as implemented in the current mainline Linux
kernels. These attributes may be implemented in future versions of
the ext2 and ext3 filesystems.
Run Code Online (Sandbox Code Playgroud)
我不知道哪个特定的主线内核版本(如果有)实现了这一点。
请注意,使用当前的技术,您有时无法控制它。使用 SSD 磁盘,每次写入都可以在不同的位置完成,保留旧数据……这不能被操作系统、文件系统或软件中的任何内容覆盖。更多关于http://www.anandtech.com/printarticle.aspx?i=3531。
您通常会在 Unix 系统上找到的最接近的等价物是加密。在 Linux(和大多数其他unices)上设置加密目录的一种简单方法是Encfs。快速开始:
mkdir .ciphertext encrypted
encfs .ciphertext encrypted
# work on encrypted/file
fusermount -u encrypted
Run Code Online (Sandbox Code Playgroud)
还有其他几个文件系统加密选项。请参阅如何通过命令行或脚本最好地加密和解密目录?,做全盘加密的最佳方式?以及Super User、Server Fault和Ask Ubuntu上的其他几个线程。
我不知道什么威胁FILE/ERASE_ON_DELETE
可以防御。请注意,在 unix 上,重写或删除文件的先前内容只能由系统管理员或对驱动器具有物理访问权限的人看到:没有“快速文件创建模式”可以用随机数据填充文件,只是恰好在文件使用的磁盘区域中。
小智 4
我不确定这是否是您正在寻找的:
dd if=/dev/urandom of=FILE
Run Code Online (Sandbox Code Playgroud)
它将随机字节写入FILE
.