1

chattr +a would be perfect if it only applied to the root of directory, not everything from there on.

Is there a way to limit chattr to just the one folder (e.g. the opposite of -R as is normally required to perform actions recursively)

I tried changing permissions for the owner (root) but it seeemed to be of no avail, perhaps because I was root?

So suppose I have a directory that needs to be undeletable, but everything within it, I want to be able to edit, remove, and create new files.

Everything on, ugh, Google applies to non-root users chowning it to root, or else manually editing each and every file, extent and future. None are ideal solutions.

2
  • What's your operating system? Apr 14, 2018 at 7:06
  • Do you mean that you want a way to prevent accidental removal of the directory... root is the proverbial unstoppable force.
    – Jasen
    Apr 14, 2018 at 7:52

2 Answers 2

1

You cannot restrict the root user.

For everyone else, standard permissions will handle this. The ability to delete a file or directory is dependent on write access to the parent directory.

3
0

mount something it it, or in a subdirectory..

1
  • Nothing prevents root unmounting that and then deleting the directory. Apr 14, 2018 at 7:00

You must log in to answer this question.

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