Linux Delete file appears rm:cannot remove '. User.ini ': Operation not permitted

Source: Internet
Author: User

Turn from: 79040755

RM-RF in Linux is very powerful, especially with the-f parameter, a lot of novice have done with root user rm-rf/command This folly, if the cloud server does not have a snapshot, it is a disaster, from the root directory all files are recursively deleted, even the system is corrupted.

However, occasionally will also encounter the use of RM-RF also deleted files, executed after the Rm:cannot remove '. User.ini ': Operation not permitted, such as:

The chattr command to Linux is required, and the CHATTR command is used to change the file properties. This directive alters the file or directory attributes stored on the ext2 file system, which have the following 8 modes:
A: Make the file or directory available for additional use only.
B: Do not update the last access time of the file or directory.
C: Compress the file or directory and store it.
D: Exclude files or directories from dumping operations.
I: Do not alter the file or directory arbitrarily.
S: Privacy delete files or directories.
S: Update files or directories instantly.
U: Remove outside of prevention.
Syntax chattr[-rv][-v< version number >][+/-/=< properties >][file or directory ...] Parameters
-R recursively handles all files and subdirectories under the specified directory.
-v< version number > set file or directory version.
-V Displays the instruction execution process.
+< Properties > Open the Item property of the file or directory.
-< Properties > Close the Item property of the file or directory.

The =< property > Specifies the Item property of the file or directory.

Go to the '. User.ini ' directory, perform a lsattr-a, look at the files below the file contains the properties, see '. User.ini ' has an ' I ' attribute, the representative must not arbitrarily change the file or directory, it is this property in trouble:

Then execute the command:

[Plain]View PlainCopy
    1. Chattr-i. User.ini

You can get rid of this property, and then we can delete it, and then it will be removed successfully:

Linux Delete file appears rm:cannot remove '. User.ini ': Operation not permitted

Related Article

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.