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 '18 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 '18 at 7:52
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.
    – roaima
    Apr 14 '18 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.