Reference to:http://blog.csdn.net/evanbai/article/details/6187578
Some files may appear to be all right, but when you try to delete them, you will get an error, like this:
[[email protected] root]# ls-l 1.txt
-rw-r--r--1 root Root 0 5 23:00 1.txt
[[email protected] root]# rm-rf 1.txt
Rm:cannot unlink ' 1.txt ': Operation not permit Ted
You are the almighty root user, actually the system tells you the operation is not allowed, is Linux crazy? Of course not, if you will use the lsattr command, the question has an answer.
[[email protected] root]# lsattr
---i----------./1.txt
--------------./weiqi.ldif
-------- ------./qi.schema
The secret is finally exposed, and under the Lsattr command, the 1.txt file has an "I" attribute, so it cannot be deleted. You can now use a series of commands below:
[[email protected] root]# lsattr 1.txt
---i----------1.txt
[[email protected] root]# chattr-i 1.txt
[[email protected] root]# rm-rf 1.txt
[[email protected] root]#
succeeded, This property is specifically designed to protect important files from being deleted, and usually the system administrator who knows how to use these commands has the ability to determine whether the file can be deleted. If you want to add more protection to a file, you can use the following command: The
chattr +i filename
Command, so that you want to delete this file is one more step. At the same time, such a file is not editable and modified. Only the root user can use the chattr command. This command can be used on Linux ext2 or ext3 systems.
[Android Pro] Root user Delete file hint: Operation not permitted