How to Make a File or Directory Immutable


This article provides a guide for how to make a file or directory immutable.

Background

Setting the immutable flag on a file or folder will prevent any changes to it. For folders, this means that no files or folders may be added to or removed from the immutable folder. However, files and folders in the immutable folder can be modified.

How to Make a File or Directory Immutable

To make a file or a directory immutable, use the "chattr" command with the "+i" flag.

chattr +i /path/to/file

How to Make a File or Directory No Longer Immutable

To make a file or directory no longer immutable, use the following command:

chattr -i /path/to/file

Conclusion

You now know how to make a file or directory immutable.

  • immutable, file permissions
  • 0 gebruikers vonden dit artikel nuttig
Was dit antwoord nuttig?

Related Articles

View Server PHP Environment with phpinfo.php

The phpinfo() function outputs a huge amount of information about the system you're using, such...

How to Create Sudo User on CentOS

This article provides step-by-step setup guide for adding Sudo user to CentOS system. The sudo...

How to Use Sudo

This article provides a guide to using a Sudo user on CentOS server. From the command line,...

Set Server Time Zones with Timedatectl

This article provides a guide to setting the server time and server time zone settings using...

508 Resource Limit is Reached

If your website is on a cPanel hosting account, you may have noticed the following error message:...