Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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, techie007, Heptite, Dave M Jan 29 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
add comment

3 Answers

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
1  
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 –  Hemal Pandya Jun 4 '13 at 18:14
add comment

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
add comment

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
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.