The chattr and lsattr of basic Linux commands

Source: Internet
Author: User

The 1.chattr command is used to change file properties:


chattr command:chattr [ -rvv ] [ mode ]  Files ... The [mode] section is composed of +-= and [Asacddiijsttu] characters, which are used to control the properties of the file. -R: Recursive processing, all files and subdirectories under the instruction directory are processed together with the; -v< version number;: Sets the file or directory version;  -v: Displays the instruction execution process; +< properties;: Opens the file or directory for that property; <: Close the Item property of the file or directory;=< property;: Specifies the property of the file or directory. S: HDD I/O sync option, similar to sync. A: Append, after setting this parameter, can only add data to the file, not delete, more for the server log file security, only root can set this property. C: Compresse, set whether the file is compressed and then stored. An automatic decompression operation is required for reading. D: No dump, the setting file cannot be the backup target of the dump program. I: The settings file cannot be deleted, renamed, linked, and cannot be written or added. The I parameter is a great help for file   system security settings. J: Journal, this parameter is set so that when the file system is:data=ordered  by the mount parameter or  data=writeback  hung   loaded, the file will be recorded first (in Journal )。 If the filesystem parameter is set to  data=journal, the parameter is automatically invalidated. S: Delete files or directories confidentially, that is, the hard disk space is fully recovered. U: In contrast to S, when set to U, the data content actually exists in the disk and can be used for undeletion. A and I are commonly used in the various parameter options. The A option enforces that only non-removable, multi-log system security settings can be added. While I is a more stringent security setting, only superuser  (root)   or a process with cap_linux_immutable processing power (identity) can apply this option. 
Chattr +i/etc/fstab #不能改动chattr +a/var/log/messages #让某个文件只能往里面追加数据, but cannot be deleted, applicable to various log files





2.lsattr command to view hidden properties of a file

lsattr [-RVADV] [files ...]  # rmdir hahah/rmdir:failed to remove ' hahah/': Operation not permitted# lsattr-d hahah/#进行查看----i----------- hahah/


This article is from the "Hello World" blog, so be sure to keep this source http://nxyboy.blog.51cto.com/10511646/1937491

Chattr and lsattr of basic Linux commands

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.