Chattr (set file hiding attribute) command in CentOS

Source: Internet
Author: User

Chattr (set file hiding attribute) command in CentOS
[Root @ linux ~] # Chattr [+-=] [ASacdistu] file or directory name
Parameters:
+: Add a special parameter. Other existing parameters do not change.
-: Remove a special parameter. Other existing parameters do not change.
=: It must be set and only the following parameters are available.
A: When the attribute A is set, the access time of the file (or directory) is atime (access)
It cannot be modified to avoid disk I/O Errors for portable computers!
S: This function is similar to the sync function! Data is synchronized to the disk!
This effectively prevents data loss!
A: When set to a, this file can only add data, but cannot be deleted, only root
This attribute can be set.
C: After this attribute is set, the file will be automatically compressed and automatically decompressed during reading,
However, during storage, data will be compressed before being stored (it seems useful for large files !)
D: When the dump (Backup) program is executed, setting the d attribute will make the file (or directory) not have the dump function
I: This is amazing! He can make an archive unable to be deleted, renamed, set links, or written
Or add new materials !』 Great help for system security!
J: when the file system format ext3 is used, setting the j attribute will record the file in
In journal! However, when the filesystem parameter is set to data = journalled
Log, so this attribute is invalid!
S: when the file sets the s parameter, it will be completely removed from the hard disk space.
U: opposite to s. When u is used to set the file, the data content still exists in the disk,
Can be used for undeletion.
Note: The above attribute settings are usually the set values of a and I, and many set values must be
Root can be set!
Example:
[Root @ linux ~] # Cd/tmp
[Root @ linux tmp] # touch attrtest
[Root @ linux tmp] # chattr + I attrtest
[Root @ linux tmp] # rm attrtest
Rm: remove write-protected regular empty file 'attrtest '? Y
Rm: cannot remove 'attrtest': Operation not permitted
# Have you seen it? Call! Even root cannot delete this file! Release settings!
[Root @ linux tmp] # chattr-I attrtest

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.