Usage of chattr command

PHP中文网
PHP中文网Original
2017-06-20 11:22:512649browse

Usage of chattr command: chattr [ -RV ] [ -v version ] [ mode ] files...
The most critical thing is in the [mode] part, [mode The ] part is a combination of characters +-= and [ASacDdIijsTtu]. This part is used to control the
attribute of the file.
+: Add parameters based on the original parameter settings.
-: Remove parameters based on original parameter settings.
=: Update to the specified parameter settings.
A: The atime (access time) of a file or directory cannot be modified (modified), which can effectively prevent the occurrence of disk I/O errors such as laptop computers.
S: Hard disk I/O synchronization option, function is similar to sync.
a: Append. After setting this parameter, data can only be added to the file but cannot be deleted. It is mostly used for server log file security. Only root can set this attribute.
c: Compresse, sets whether the file is compressed before being stored. Automatic decompression is required when reading.
d: No dump, the setting file cannot be the backup target of the dump program.
i: The setting file cannot be deleted, renamed, link relationships set, and content cannot be written or added. The i parameter is very helpful for the security settings of the file system.
j: Journal, set this parameter so that when passing Mount parameters: data=ordered or data=writeback mount The file system is loaded, the file will be recorded (in the journal) first when written. If the filesystem parameter is set to data=journal, this parameter is automatically invalid.
s: Delete files or directories confidentially, that is, all hard disk space is recovered.
u: Contrary to s, when set to u, the data content is actually still stored on the disk and can be used for undelete.
Commonly used in each parameter option are a and i. The a option is forced to be added but not deleted, and is mostly used for security settings of the log system. i is a more stringent security setting. Only superuser (root) or a process with CAP_LINUX_IMMUTABLE processing capability (identity) can apply this option.

#Lock file: chattr +i file name

Unlock: chattr -i file name

Attribute view: ##lsattr File name

The above is the detailed content of Usage of chattr command. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn