I'm interested in protecting a parent directory (e.g., test
in the example below) by being removed (i.e., accidentally, without explicit root priviledges), while at the same time I need to be able to write inside it (as a non-root user).
For instance, suppose that we have a parent directory test
with the following sub-directories:
test/
|-- dir_1
`-- dir_2
Let's suppose that root
is the owner and the group is some_group
:
drwxr-xr-x 4 root some_group 4096 Apr 16 13:38 .
drwxr-xr-x 3 some_user some_user 4096 Apr 16 13:36 ..
drwxr-xr-x 2 root some_group 4096 Apr 16 13:38 dir_1
drwxr-xr-x 2 root some_group 4096 Apr 16 13:38 dir_2
Now, I want a user who is member of some_group
not to be able to remove dir_1
and dir_2
, which I believe I've guaranteed by setting them to 755
, but at the same time I need this user to be able to write inside test
, but without being able to delete the whole test
directory. Is there any way of doing this? Thank you.