Usually chattr is used for changing the file attributes on Linux file system. It is different from chmod command. Any file’s permission set by chmod command can be bypassed with the root privilege. Whereas if a file is set immutable by the chattr command it cannot be modified even with super user privilege. Afterall chattr command can be used only with super user privilege. Even though it is more efficient than chmod.
To set a file immutable run
chattr +i file
with super user privilege.