How to Lock Files in Linux

To prevent accidental operations on the server and disallow any actions on certain files, you can try the following method to lock a file.

chattr +i config.php  #Taking config.php as an example file

Use -i to unlock:

chattr -i config.php  #Taking config.php as an example file

lsattr   #View file attributes

 

 

Leave a Comment

Your email address will not be published.