chattr use

chattr: lock the file, cannot be deleted, cannot be changed
+a: can only add content to the file, but cannot be deleted,
chattr +a /etc/passwd
-d: cannot be deleted
Locking: chattr +i /etc/passwd file cannot be deleted, Can not be changed, can not be moved to
view and lock: lsattr /etc/passwd file adds a parameter i to indicate lock and
unlock: chattr -i /home/omd/h.txt-means to unlock

#chattr +i  /etc/shadow     ——>添加“i”隐藏属性后,就无法更动这个文件了
#chattr -i  /etc/shadow     ——>解除"i"这个隐藏属性 

lsattr [-aR]
-a: List the attributes of hidden files;
-R: List the data of the subdirectories together!

Guess you like

Origin blog.51cto.com/6519883/2592289