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
- 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