linux下防止rm-rf /刪除,讓人崩潰

1.下載safe-rm軟件:vim

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

2.解壓:tar xf safe-rm-0.12.tar.gz.net

3.備份原有rm:mv /usr/local/bin/rm /usr/local/bin/rm.bakcode

4.替換:mv safe-rmblog

5.編輯配置文件限制不能刪除的目錄:vim /etc/safe-rm.conftoken

/
/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/profileget

7.執行刪除效果:it

相關文章
相關標籤/搜索