chattr command for setting a file immutable

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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s