I am running apache on a MacOSX Lion machine. I've got this site (Joomla 1.5) that creates files in the cache directory or it's subdirectories. There are instances when the subdirectories are also created by apache.

When files and directories are created by apache, they end up with the group:user set to _www:_www (apache user on mac).

Problem is, I often want to delete these files while I'm logged in with my credentials (say code_poet). I'm not part of the _www group, so obviously, I cannot delete these files as these files typically have rwxr_xr_x set.

My question, therefore is how best to get around this problem, without adding myself to the _www group (I'm not even sure if I could add myself to that group). A workaround obviously is to use sudo, but that doesn't work if I'm trying to do a delete via a UI tool like SmartGit.

PS: I'm not too familiar with these unix like permission concepts but I read something about mask bit and tried to set the cache folder perms to u+rws while having the cache folder perms owner:group set to code_poet:www, but it does not achieve the desired result.

If I understood correctly, files/directories created under this folder should inherit the owner id from the parent.

  • Found a partial answer here: serverfault.com/questions/373750/…. Now, however, when apache creates a file, while they do have the group set to staff (my group on mac), the perms for group are r--. So naturally, I cannot edit/delete the file without a sudo. How do I overcome this? – Code Poet Jul 24 '12 at 5:52

Make the files owned by your user account, and group owned by apache. Then make them group writable, so that both you and apache can write to them.

chown -R user._www /path/to/cache
chmod -R ug+w,o-w /path/to/cache
  • I have this done already. The problem is when apache creates a directory inside cache, that directory ends up with group:owner set to _www:_www. Then I cannot delete those directories without a sudo. – Code Poet Jul 24 '12 at 4:47
  • When files are created in this folder they have perms for group set to 'r-x', so I'm not able to edit/delete them. – Code Poet Jul 24 '12 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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