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.执行删除效果:
一些事情一直在干,说不定以后就结果了呢
本文来自博客园,作者:chenjianwen,转载请注明原文链接:https://www.cnblogs.com/chenjw-note/p/11342430.html