MAN chattr | GREP ^ATTRIBUTES:
A file with the 'a' attribute set can only be open in append mode for writing.
A file with the 'c' attribute set is automatically compressed on the disk by the kernel.
A file with the 'd' attribute set is not candidate for backup when the dump(8) program is run.
A file with the 'i' attribute cannot be modified.
chattr ±=[aAcCdDeijPsStTu] target-file
a -- 追加
[root@ansible ~]# chattr =a test[root@ansible ~]# lsattr test
-----a-------------- test[root@ansible ~]# echo "Hello" >> test[root@ansible ~]# echo "Hello" > test
-bash: test: Operation not permitted
[root@ansible ~]#
i -- 锁
[root@ansible ~]# chattr =i test[root@ansible ~]# lsattr test
----i--------------- test[root@ansible ~]# echo "Hello" >> test
-bash: test: Operation not permitted
[root@ansible ~]# rm -rf test
rm: cannot remove 'test': Operation not permitted
[root@ansible ~]# mv test /tmp
mv: cannot move 'test' to '/tmp/test': Operation not permitted
[root@ansible ~]#