How to remove a non-empty directory which is not owned by the user in Linux?
Posted
by Alex B
on Server Fault
See other posts from Server Fault
or by Alex B
Published on 2010-06-11T07:29:17Z
Indexed on
2010/06/11
7:33 UTC
Read the original article
Hit count: 174
linux
|permissions
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.
© Server Fault or respective owner