Change file attributes
Linux chattr command syntax
Function: chattr command is used to change file attributes.
Syntax: chattr [-RV][-v<version number>][ /-/=<properties>][file or directory...]
Linux chattr command example
Use the chattr command to prevent a key file in the system from being modified:
chattr +i /etc/resolv.conf lsattr /etc/resolv.conf
will display the following attributes
----i-------- /etc/resolv.conf
Allow a file to only append data to it, but not delete it, applicable to various log files:
chattr +a /var/log/messages