How to prevent rm -rf / cause system crashes?

background:

 The company's dev environment developers can log and development have root privileges. However, due to the development level of each Linux is not the same, there are some developers even directly use rm -rf /  cause paralysis of the entire system, the system has to get, because there is no back up before we had to resume

 

installation:

Download See my article resource links:  https://download.csdn.net/download/knight_zhou/12175097

1. Download safe source package (diameter may be downloaded from the following Internet Official):

wget https://launchpad.net/safe-rm/trunk/0.12/+download/safe-rm-0.12.tar.gz 

 

2. Extract safe-rm

tar -zxf safe-rm-0.12.tgz

 

3. Copy to the safe-rm / usr / bin directory, direct replacement system rm command

cp safe-rm-0.12/safe-rm   /usr/bin/rm

 

4. Configure path blacklist (Blacklist path rm can not be deleted)

vim /etc/safe-rm.conf

/
/bin
/boot
/dev
/etc
/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

Guess you like

Origin blog.csdn.net/knight_zhou/article/details/104413553