LSATTR parameters | |
-a | Display all files and directory, including the additional built -in character that starts with “.”, The current directory “.” And upper directory “..” |
-d | Show, the directory name, not its content |
-R | recursive processing, process all the files and subdires in the specified directory together |
-v | Display file or directory version |
Chattr parameters | |
+ | increase |
– | decrease |
= | settings |
A | When the attribute A is set, the access time of this file (or directory) ATIME (Access) will not be modified, which can avoid the situation where the computer is easy to produce disk I/* o errors.
After setting a |
a | , this file will only increase the data without deleting. Only root can set this attribute |
b | The last access time of the file or directory does not update the file or directory |
S | This function is a bit similar to SYNC, which is to simultaneously write data into the disk, which can effectively avoid data loss |
c | After setting this attribute, it will automatically compress this file and automatically decompress when reading. But when storing, it will be compressed in storage(very useful for large* files) |
d | When the dump (backup) program is executed, setting the D attribute will make the file (or directory) have DUMP effect;+D can skip the file when backup(Eliminate the file or directory outside the dump operation) |
i | This parameter can make a file “” cannot be deleted, renamed, set links, and cannot write data. It is very helpful for system security |
s | When the file sets the S parameter, it will be completely moved out of this hard disk space |
u | is the opposite of s. When using the U configuration file, the data content can actually exist in the disk, which can be used to cancel delete(Prevent accident deletion) |
Case
[[email protected] ~]# chattr +i yum.sh
[[email protected] ~]# lsattr yum.sh
----i----------- yum.sh
[[email protected]~]# RM -RF YUM.SH
RM: Unable to delete "yum.sh": non -allowed operation[email protected] ~]# chattr -i yum.sh
[[email protected] ~]# lsattr yum.sh
---------------- yum.sh
[[email protected] ~]# rm -rf yum.sh
[[email protected] ~]# ls
anaconda-ks.cfg yum.sh.bf