Setting the immutable flag on a file or folder will prevent any changes to it. For folders, this means that no files or foldes may be added to or removed from the immutable folder. However, files and folders in the immutable folder can be modified.
To make a file or a directory immutable, use the "chattr" command with the "+i" flag.
chattr +i /path/to/file
The following article explains how to remove the immutable flag.