The a
Linux file attribute is often documented as applicable to files.
chattr(1) manpage:
A file with the 'a' attribute set can only be open in append mode for writing.
0x20 File can only be appended (EXT4_APPEND_FL).
My questions are:
- Is
chattr +a
restricted to files only? - Is it recursive on new subdirectories and files?
Best Answer
The append only flag (
chattr +a
) prevent from removing the directory, a well as files and directories created directly inside that directory:Create test directory and files:
That directory can't be deleted:
Now create files and directory inside it:
Let's inspect that:
Try to erase stuffs:
Finally, sub-sub-directory and files in sub-directories are not protected:
Again, note that only
/tmp/foo
had the append flag: