首先,都知道在linux中“rm -rf /”命令,今个咱就破它。
第一步 下载
[root@xuegod1 safe-rm-0.12]# wget https://launchpad.net/safe-rm/trunk/0.12/+download/safe-rm-0.12.tar.gz
第二部 解压
[root@xuegod1 safe-rm-0.12]# tar -xf safe-rm-0.12.tar.gz -C /opt
第三部 查看INSTALL
[root@xuegod1 safe-rm-0.12]# tac INSTALL
all users on your system use safe-rm instead of the real rm.
Then, putting safe-rm in /usr/local/bin and renaming it to "rm" will ensure that
PATH=/usr/local/bin:/usr/bin:/bin
For example, if your path contains:
your path.In order to install safe-rm and make sure that it is being picked up instead of
第四部 安装配置
[root@xuegod1 safe-rm-0.12]# cp safe-rm /usr/local/bin/rm
[root@xuegod1 safe-rm-0.12]# ll !$
ll /usr/local/bin/rm
-rwxr-xr-x 1 root root 6179 3月 3 21:38 /usr/local/bin/rm
[root@xuegod1 bin]# export PATH=/usr/local/bin:/bin:/usr/bin:$PATH >>/etc/profile
[root@xuegod1 bin]# source /etc/profile
第五步 配置保护配置文件
[root@xuegod1 safe-rm-0.12]# echo "***">/etc/safe-rm.conf “ *** ” #需要保护的目录
#如果你操作 “rm -rf” 命令,如果目标在/etc/safe.conf文件中,自动提示safe-rm: skipping ***
当然,写个shell脚本去定时情况一个垃圾文件也是个不错的选择配合定时任务,就完美了。
愿每个热爱linux的同志们,加油!!!