DEV Community

Nurul Islam Rimon
Nurul Islam Rimon

Posted on

Want to make your file Immutable? Lock it down with (chattr +i) and keep your files untouchable! πŸ”’πŸ’»

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!

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs