[Android Pro] Root user Delete file hint: Operation not permitted

Source: Internet
Author: User

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

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.