Want to make your file Immutable? Lock it down with (chattr +i) and keep your files untouchable! 🔒💻

Nurul Islam Rimon - Feb 13 - - Dev Community

Make your file Immutable to prevent unwanted overwrite.

chattr +i /your-file-path.txt
Enter fullscreen mode Exit fullscreen mode

It will change your file's attribute. So you can check the attribute using the command below:

lsattr /your-file-path
Enter fullscreen mode Exit fullscreen mode

If ---i---- exist, that means immutable attribute added.

It could save you from some cron job also. Last time I resolved my Nginx configuration overwrite by HestiaCP issue through the approach.
Have a good day!

. . . . . .