I (and my collaborators) have a directory tree containing ~160K files (most of them are automatically generated by data gathering instrumentation).These files reside in a system that gets backed up constantly, and therefore, we are not too worried about data loss or corruption, as long as we have the information required to restore from backup when needed.We're much more worried about inadvertent data loss or corruption resulting from user error (especially buggy user-written code), because this means, at best, wasted work until the problem is detected.Therefore, we want to make these files undeletable and unmodifiable.Unfortunately, neither of us has permission to use chattr on this system, which rules out applying chattr +i to these files.Is there some other way, not requiring special permissions, to approximate chattr +i?The rest of this post describes a couple of possibilities we've considered, along with their shortcomings.One possibility would be to apply chmod -R a-w DATA, where I've used DATA as shorthand for the root of the directory tree in question.This is fine as a first approximation, but it goes a bit too far, because it renders many operations that we may need to perform occasionally (e.g. consolidating several subdirectories into one)A second possibility would be something likefind DATA -type f -exec chmod a-w {} \;This is a bit more flexible, and the files can no longer be modified, but they can still be deleted.
How to make files unmodifiable and undeletable without `chattr`?
files;permissions