Magical command chattr

Transfer: https: //www.cnblogs.com/ftl1012/p/chattr.html  

Common command parameters

A: That Atime, tell the system not to modify the last access time to the file.
S: That Sync, once the application performs write operations on the file, the system immediately modify the results written to disk.
a: That Append Only, the system only allows additional data after the file is not allowed to cover any process or truncate the file. If the directory has this attribute, the system will only allow the establishment in this directory and modify files, not delete any files.
b: do not update the last access time of the file or directory.
c: to store the file or directory compression.
d: when the dump program is executed, the dump file or directory is not backed up.
D: Check the compressed file errors.
i: That Immutable, the system does not allow this document to make any changes. If the directory has this attribute, then any process can only modify the files under a directory, not allowed to create and delete files.
s: delete the file completely unrecoverable, because it is removed from the disk, and then filling the area where the file zero.
u: When an application request to delete the file, the system will retain its data blocks in order to later be able to restore the deleted file, to prevent accidental deletion of a file or directory.
t: file system supports tail merging (tail-merging).
X: direct access to the contents of compressed files.

 Frequently used commands show

chatter: locked file can not be deleted, you can not change
        + a: only add content to the file, but not delete,
              the chattr + A / etc / passwd
        -d: can not delete
        locked: chattr + i / etc / passwd file can not be deleted, You can not change, can not be moved
        to view the lock: lsattr / etc / passwd file adds a parameter i represents the lock
        to unlock: chattr -i /home/omd/h.txt - represents a lift
hidden chattr command:

which chattr
mv /usr/bin/chattr  /opt/ftl/
cd /opt/ftl/ 
mv chattr h -> Change command, use aliases to hide their identity h
/ Opt / ftl / h + i /home/omd/h.txt -> h with the use of the command chattr
lsattr /home/omd/h.txt -> View encrypted information

To recover the hidden command

mv h /usr/bin/chattr
chattr -i /home/omd/h.txt
lsattr /home/omd/h.txt

Guess you like

Origin www.cnblogs.com/yorkyang/p/12069459.html