linux下防止rm-rf /删除,让人崩溃

1.下载safe-rm软件:

safe-rm下载地址: https://launchpad.net/safe-rm
命令 wget -c https://launchpadlibrarian.net/188958703/safe-rm-0.12.tar.gz

2.解压:tar xf safe-rm-0.12.tar.gz

3.备份原有rm:mv /usr/local/bin/rm /usr/local/bin/rm.bak

4.替换:mv safe-rm

5.编辑配置文件限制不能删除的目录:vim /etc/safe-rm.conf

/
/bin
/boot
/dev
/etc
/home
/initrd
/lib
/proc
/root
/sbin
/sys
/usr
/usr/bin
/usr/include
/usr/lib
/usr/local
/usr/local/bin
/usr/local/include
/usr/local/sbin
/usr/local/share
/usr/sbin
/usr/share
/usr/src
/var
/data/chenjianwen

6.配置环境变量:echo "PATH=/usr/local/bin:/bin:/usr/bin:$PATH" >> /etc/profile && source /etc/profile

7.执行删除效果:

linux下防止rm-rf /删除,让人崩溃

 

上一篇:mysqld_safe启动mysql数据库的参数


下一篇:Help Hanzo(区间内素数个数)