I want to create a directory which is undeletable, and that you can only add files, not delete any file therein.

I was reading the man chattr page and I came across attribute a

A file with the 'a' attribute set can only be opened in append mode for writing. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute.

But it just mentions files. Can I apply it to a directory? Something like

sudo chattr +a +u /path/to/dir

1 Answer 1


This works

sudo chattr +a +u /path/to/dir

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .