Linux under Limit RM-RF/

Source: Internet
Author: User

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.