Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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?

share|improve this question

marked as duplicate by Tog, Kevin Panko, Ƭᴇcʜιᴇ007, Heptite, Dave M Jan 29 '14 at 17:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Are the subdirectories being created with the same permission set? – Fake Name Jul 23 '10 at 8:43
up vote 6 down vote accepted

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.

share|improve this answer
I think this points out a missing tool -- there should be some program, setuid root, that allows someone to recursively remove any directory in a directory they own. (Which should prompt for confirmation by default, include appropriate safeties, and so on.) – David Schwartz Nov 4 '11 at 0:10
@DavidSchwartz I think this is very important. sudo is not quite same because it allows user to delete anything – Miserable Variable Jun 4 '13 at 18:14

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.

share|improve this answer

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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged .