How to remove a non-empty directory which is not owned by the user in Linux?
- by Alex B
If a directory "foo" is owned by user A and contains a directory "bar", which is owned by root, user A can simply remove it with rmdir, which is logical, because "foo" is writable by user A.
But if the directory "bar" contains another root-owned file, the directory can't be removed, because files in it must be removed first, so it becomes empty. But "bar" itself is not writable, so it's not possible to remove files in it.
Is there a way around it? Or, convince me otherwise why it's necessary.