Chattr: Profile Hiding properties (Note:chattr command only takes effect on EXT2/EXT3 file system )
Syntax: chattr [+-=][asacdistu] file or directory name
Parameters:
+: Add a special parameter, other existing parameters are not moved.
-: Remove a special parameter, other parameters are not moving.
=: Configure the parameters that follow
A: When you use the A attribute, if you have access to this file (or directory), his access time atime will not be modified, to avoid the slow I/O machine excessive access to the hard disk. This is helpful for slower computers
S: General file is non-synchronous write to the hard disk, if you add s This property, when you make any file changes, the change will be "synchronous" to write to the hard disk.
A: After using a, this file will only add data, not delete or modify the data, only root can configure this property.
C: After this attribute is used, the file will be "compressed" automatically, and will be automatically decompressed when it is read, but it will be compressed and stored before it is stored.
D: When the dump program is run, using the D property will allow the file (or directory) to not be backed up by dump
I: Using the I attribute, he can make a file "cannot be deleted, renamed, configuration links can not write or add data" for system security has a considerable benefit, only root can use this property.
S: When the file uses the S property, if the file is deleted, he will be completely removed from the hard disk space, so if deleted by mistake, it is completely unable to save back.
T: In contrast to S, when using U to configure a file, if the file is deleted, then the data content actually exists on the hard disk and can be used to save the file.
Note: The configuration values of a and I are common in property configuration, and many configuration values must be root to be configured
Example: Create a file under the TMP directory, add the I parameter, try to delete
[email protected] tmp]# Touch attrtest
[Email protected] tmp]# chattr +i attrtest
[Email protected] tmp]# RM attrtest
RM: Do you want to delete the general empty file "Attrtest" with write protection? Y
RM: Unable to delete "Attrtest": Operation not allowed
[Email protected] tmp]#
Example: Canceling the I parameter in the previous example
[Email protected] tmp]# chattr-i attrtest
[Email protected] tmp]# RM attrtest
RM: Do you want to delete the generic empty file "Attrtest"? Y
[Email protected] tmp]#
Lsattr: Show file Hidden properties
Syntax: lsattr [-ADR] File or directory
Parameters:
-A: The properties of the hidden file are also displayed.
-D: If a directory is followed, only the properties of the directory itself, not the file names within the directory.
-r: Data along with subdirectories are also listed.
Example:
[email protected] tmp]# Touch attrtest
[Email protected] tmp]# chattr +aiu attrtest
[Email protected] tmp]# lsattr attrtest
-u--ia-------Attrtest
[Email protected] tmp]#
This article from "11117200" blog, declined reprint!
Linux file Hiding properties chattr, lsattr