zoukankan      html  css  js  c++  java
  • Shred命令 学习

    今天看到一则新闻《40岁程序员“删库”被判7年:曾被无视 怒删9TB财务数据》里面提到了一个命令 Shred,发现还没怎么用过。

    开始研究一下:

    Shred 帮助信息

    [xxx@xxx~]$ shred --help
    Usage: shred [OPTION]... FILE...
    Overwrite the specified FILE(s) repeatedly, in order to make it harder
    for 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) 覆盖N次,而不是默认的3次 --random-source=FILE get random bytes from FILE -s, --size=N shred this many bytes (suffixes like K, M, G accepted) 粉碎数据为指定字节的碎片(可使用K、M 和G 作为单位) -u, --remove truncate and remove file after overwriting 在覆盖后截断并删除文件 -v, --verbose 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 最后一次使用0 进行覆盖以隐藏覆盖动作 --help display this help and exit --version output version information and exit If FILE is -, shred standard output. Delete FILE(s) if --remove (-u) is specified. The default is not to remove the files because it is common to operate on device files like /dev/hda, and those files usually should not be removed. When operating on regular files, most people use the --remove option.

    如果指定了——remove (-u),则删除文件。默认情况下不删除文件,因为操作设备文件(如/dev/hda)是很常见的,这些文件通常不应该被删除。当操作普通文件时,大多数人使用——remove选项。 CAUTION: Note that shred relies on a very important assumption: that the
    file system overwrites data in place. This is the traditional way to do things, but many modern file system designs do not satisfy this assumption. The following are examples of file systems on which shred is not effective, or is not guaranteed to be effective in all file system modes:

    注意,shred依赖于一个非常重要的假设:文件系统会覆盖现有的数据。这是做事情的传统方式,但是许多现代文件系统设计不满足这个假设。以下是在所有文件系统模式下,shred无效或不能保证有效的文件系统示例:
    * log-structured or journaled file systems, such as those supplied with AIX and Solaris (and JFS, ReiserFS, XFS, Ext3, etc.) # 日志结构的或日志记录的文件系统,如附带的文件系统AIX和Solaris(以及JFS、ReiserFS、XFS、Ext3等)
    * file systems that write redundant data and carry on even if some writes
    fail, such as RAID-based file systems
    # 写冗余数据的文件系统,即使有些写失败也会继续写,例如基于raid的文件系统
    * file systems that make snapshots, such as Network Appliance's NFS server、
    # 创建快照的文件系统,如网络设备的NFS服务器
    * file systems that cache in temporary locations, such as NFS version 3 clients # 缓存在临时位置的文件系统,例如 NFSv3

    * compressed file systems
    # 压缩文件系统 In the
    case of ext3 file systems, the above disclaimer applies (and shred is thus of limited effectiveness) only in data=journal mode, which journals file data in addition to just metadata. In both the data=ordered (default) and data=writeback modes, shred works as usual. Ext3 journaling modes can be changed by adding the data=something option to the mount options for a particular file system in the /etc/fstab file, as documented in the mount man page (man mount).
    # 对于ext3文件系统,上述免责声明适用
    (因此,shred的效率有限)仅在data=journal模式下使用,该模式除了归档元数据外,还归档数据。在data=ordered(默认)和data=writeback模式下,shred照常工作。

    Ext3日志记录模式可以通过在/etc/fstab文件中的特定文件系统的挂载选项中添加data=something选项来更改,如挂载手册页(man mount)中所述。
    
    In addition, file system backups and remote mirrors may contain copies
    of the file that cannot be removed, and that will allow a shredded file
    to be recovered later.
    # 此外,文件系统备份和远程镜像可能包含无法删除的文件副本,这将允许稍后恢复破碎的文件。 Report shred bugs to bug
    -coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> For complete documentation, run: info coreutils 'shred invocation'

    PS:虽然shred命令可以安全的从硬盘上擦除数据,但是注意它不能用在坏的扇区上,另外shred命令接一个完整的分区路径比接一个文件名更保险,因为有些类型的文件系统会保留备份,而往往shred命令是不会去删除这些备份文件的。

    #shred/dev/sda1

    效果参考:

    还提到一款傻瓜式Mac 系统上面的WiFi mac地址修改工具

    官方网址:https://wifispoof.com/

    WiFiSpooffor mac是一款适用于Mac系统的wifi地址修改器,用户只需要安装WiFiSpoof for mac,点击打开就能很直观的修改Mac地址,很容易操作。

    那么不用软件怎么修改mac地址?

    MAC 终端命令:
    
     1.查看路由:
    
    netstat -r
    
     2.添加路由(可分别为有线和无线网络添加路由,实现同时访问不同网段):
    
        sudo route -nv add -net 192.168.x.x -netmask 255.255.255.0 -interface en0
    
        注:en0—有线,en1—无线  
    
     3.修改Mac地址:
    
    可以用terminal命令(en1=wifi,en0=Ethernet):
    
    sudo ifconfig en1 down--关闭无线
    
    sudo ifconfig en1 ladder 00:11:22:33:44:55--修改mac地址
    
    sudo ifconfig en1 up--打开无线

      

    参考资料:

    https://blog.51cto.com/laoxu/1299931

    https://blog.csdn.net/boomjane_testingblog/article/details/60579470

    https://www.sohu.com/a/201309965_487482

    https://blog.csdn.net/klforeverl/article/details/16338961

  • 相关阅读:
    Jmeter 设置中文
    不同JDK版本直接的intern()方法的区别---JDK6 VS JDK6+
    java内存模型中堆和栈的区别
    JVM三大性能调优参数 -Xms -Xmx -Xss的含义
    Class<?>中isAssignableFrom()方法与instanceof关键字
    Lua中ipairs 和 pairs的区别
    Redis主从同步中的repl_backlog_buffer和repl_buffer
    Redis-开启使用AOF日志
    将windows 文件复制到linux上去
    winform集成第三方应用引起灾难性崩溃处理
  • 原文地址:https://www.cnblogs.com/Cong0ks/p/14261174.html
Copyright © 2011-2022 走看看