Operating instructions:
In order to prevent the operation of operating under Linux RM-RF/, or rm-rf some of the more important directories, we do the following to restrict the deletion of RM
1. Download the source installation package
Https://raw.githubusercontent.com/bazingafraser/cv/master/article/rm/safe-rm-0.12.tar.gz
2, the specific operation is as follows
[[Email protected] ~] Tar-xvzf safe-rm-0.12.tar.gz
[[Email protected] ~] CD safe-rm-0.12
[Email protected] safe-rm-0.12]# MV SAFE-RM/USR/LOCAL/BIN/RM
[Email protected] safe-rm-0.12]# chown ROOT:ROOT/USR/LOCAL/BIN/RM
[Email protected] safe-rm-0.12]# Vi/etc/profile
The last line is added:
Path=/usr/local/bin:/bin:/usr/bin: $PATH
[[email protected] safe-rm-0.12]# source/etc/profile environment variable takes effect
[Email protected] safe-rm-0.12]# vim/etc/safe-rm.conf
Writes a directory that prohibits deletion to the file, one row per directory
/
/boot
/sbin
/data/ccc
Save to exit
[Email protected] safe-rm-0.12]#
3. Testing
Create a CCC directory in/data and write the/etc/safe-rm.conf
Save exit after removing CCC appears following return, proving the operation succeeded
[Email protected] data]# RM-RF ccc/
Safe-rm:skipping ccc/
[Email protected] data]#
Linux under Limit RM-RF/