linux删除文件夹(linux删除文件夹及其子文件)

更新时间:2023-03-02 08:37:14 阅读: 评论:0

概述

在大多数情况下,我们在linux中删除文件和目录是通过rm命令,这些方法并不能永久、安全地从硬盘(或任何存储介质)中删除文件。

假设文件包含机密或机密内容,例如系统的用户名和密码,攻击者可以轻松恢复文件的已删除副本并访问这些文件 。

在本文中,我们分享一些用于在 Linux 中永久安全地删除文件的命令行工具。

一、Shred -覆盖文件以隐藏内容

1、安装软件包

yum install coreutils-8.22-24.el7_9.2.x86_64 -y

2、命令及参数选项

[root@192_168_209_128 ~]# shred --helpUsage: shred [OPTION]... FILE...Overwrite the specified FILE(s) repeatedly, in order to make it harderfor even very expensive hardware probing to recover the data.Mandatory arguments to long options are mandatory for short options too. -f, --force change permissions to allow writing if necessary -n, --iterations=N overwrite N times instead of the default (3) --random-source=FILE get random bytes from FILE -s, --size=N shred this many bytes (suffixes like K, M, G accepted) -u, --remove[=HOW] truncate and remove file after overwriting; See below -v, --verbo show progress -x, --exact do not round file sizes up to the next full block; this is the default for non-regular files -z, --zero add a final overwrite with zeros to hide shredding --help display this help and exit --version output version information and exit

选项说明:

-z- 添加一个带有零的最终覆盖以隐藏切碎-v– 可以显示操作进度-u- 覆盖后截断和删除文件-n– 指定覆盖文件内容的次数(默认为 3)

3、示例

shred覆盖文件以隐藏其内容,也可以选择删除它。

$ shred -zvu -n 5 passwords.list二、Wipe —在 Linux 中安全擦除文件

Linux wipe命令可以安全地从磁存储器中擦除文件,从而无法恢复。

1、安装软件包

首先,您需要安装擦除工具,运行下面的相应命令:

$ sudo yum install wipe [On RedHat bad systems]

2、命令及参数选项

$wipe --help

选项:

-r- 告诉擦除递归到子目录-f- 启用强制删除和禁用确认-i- 显示删除过程的进度

3、示例

以下命令将销毁目录private下的所有内容。

$ wipe -rfi private/*

[

三、Linux 安全删除工具包

Secure-delete是一个安全文件删除工具的集合,其中包含srm (cure_deletion) 工具,用于安全删除文件。

1、安装软件包

首先,您需要使用以下相关命令安装它:

$ sudo yum install cure-delete [On RedHat bad systems]

2、命令及参数选项

$[root@192_168_209_128]# srm --helpUsage: srm [OPTION]... [FILE]...Overwrite and remove (unlink) the files. By default u the 35-pass Gutmannmethod to overwrite files. -d, --directory ignored (for compatability with rm(1)) -f, --force ignore nonexistant files, never prompt -i, --interactive prompt before any removal -x, --one-file-system do not cross file system boundaries -s, --simple overwrite with single pass using 0x00 (default) -P, --openbsd overwrite with three pass like OpenBSD rm -D, --dod overwrite with 7 US DoD compliant pass -E, --doe overwrite with 3 US DoE compliant pass -G, --gutmann overwrite with 35-pass Gutmann method -C, --rcmp overwrite with Royal Canadian Mounted Police pass -r, -R, --recursive remove the contents of directories -v, --verbo explain what is being done -h, --help display this help and exit -V, --version display version information and exit

选项:

-f - 强制删除-r - 递归删除,删除目录及目录中的内容-v – 启用详细模式-z– 用零而不是随机数据擦除最后一次写入

3、示例

您可以使用srm工具在 Linux 系统上安全地删除文件或目录,如下所示。

$ srm -vz private/*

[

本文发布于:2023-02-28 21:02:00,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/zhishi/a/1677717434100734.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:linux删除文件夹(linux删除文件夹及其子文件).doc

本文 PDF 下载地址:linux删除文件夹(linux删除文件夹及其子文件).pdf

标签:文件夹   其子   文件   linux
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 实用文体写作网旗下知识大全大全栏目是一个全百科类宝库! 优秀范文|法律文书|专利查询|