2

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
Nasir Riley
  • 11,422

1 Answers1

1

This works

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