12

I created a directory somewhere with permissions rwxrwxr-x so that other users in my group can create files and directories in it.

I do need to be able to delete the contents in this "public" directory, but it seems that while I am able to remove any files in this directory I cannot remove and subdirectories under it.

Is there a way to remove such subdirectories owned by others under a directory owned by me?

3 Answers3

14

Deleting a file (or empty directory) requires write access to the parent directory, which you have as owner.
Deleting a non-empty directory requires that you empty the directory first, which you can't do, as you don't have write access to that directory (as it was created by other users).

So you need to use sudo to get root access to delete those directories.

1

You could add your account to sudoers and 'sudo rm -R' the folder.

I am not aware of a setting you can apply to do it normally.

Toby
  • 729
-1

logically you should if the directory is yours and is writeable. However i have heard of a subdirectory that you cannot write to preventing removing the folder/deleting files.

If you like try the command rm -f filename or rm -rf dir to remove a directory.