I have a process that create directories and files inside a working directory, ex:
/workingdir/file1
/workingdir/file2
/workingdir/dir1/file1
/workingdir/dir1/dir2/file1
/workingdir/dir1/file2
I need to avoid deletion/overwrites of created folders/files for that user, but allow subsequent folders/subfolders/files creation.
I try permissions, gid, acl with no luck.
What is the correct way to do that ? (i can use a cron job if needed)
Best Answer
You should be able to achieve something by setting extended attributes with chattr.
Use
chattr +a
on your directories. This will allow them to be added to but will stop them from having files removed.Use
chattr +i
to make your files immutable - they cannot be changed once this is set.