ubantu file attributes

chattr is used to change file attributes, lsattr can be used to view the properties of a file, execute the command lsattr /etc/sysctl.conff will be able to see the attributes of the current file;

It can be found in the current file i have a property inspection command help document i can see the file properties can not be changed, but can not be removed, even if the root user can not be.

2, since we know the cause of the file inoperable i added a property, so the appropriate solution is to remove the i attribute of the file, and then modify the contents of this file, the best file recovery after the operation is completed i attributes.

Removing i attribute: chattr -i /etc/sysctl.conf

Add i attribute: chattr + i /etc/sysctl.conf

Extended Information

chattr command is used to modify file attributes, chattr command requires root privileges.

File attributes:

a: append only; the system only allows additional data after the file is not allowed to cover any process or truncate the file. If the directory has this attribute, the system will only allow the establishment in this directory and modify files, not delete any files.


c: compressed; system in a transparent way the compressed file. When reading from the file, it returns the data after decompression; and when writing data to the file, the data is first written to disk only after being compressed.


d: no dump; during file system backup, dump will ignore the file.


i: immutable; the system does not allow this document to make any changes. If the directory has this attribute, then any process can only modify the files under a directory, not allowed to create and delete files.

Guess you like

Origin www.cnblogs.com/TJGKK/p/11411902.html