The chattr +i command makes a file immutable, meaning it can’t be edited, deleted, or renamed—even by root. Use it like this:
chattr +i filename
To reverse it:
chattr -i filename
It’s perfect for protecting system files or critical configs from accidental changes. Check attributes with:
lsattr filename
Note: Only works on ext-based filesystems and requires root access. Use wisely to keep your Linux environment safe and stable.
Best Regards,
N I Rimon