0

I have a problem with a web application and its cache directory (I'm using symfony)

This cache directory is populated by the www-data user when visiting the application pages. The cache can also be populated or deleted executing some commands from console.

The problem is I use this machine for development and I need to access via web, and flush caches, create new models, etc via console.

Currently I have 777 permissions to make it writable by anyone. If I browse a page (and the cache is generated) I can't, for example, create a new model because I don't have permissions to alter the files generated by www-data. I must use sudo. But then, the files have root permissions and can't be written by apache, and the page crashes...

How can I make this directory (and its dinamically-generated contents) writable by both users?

Thank you very much.

1 Answer 1

1

"The problem is I use this machine for development" -- yeah, that is a problem. Stop doing that, or at least use a separate app instance (developmestuction is no fun).

To make a directory writable by both you and the webserver, you can either use extended ACLs to grant the webserver write access:

setfacl -m u:www-data:rwX /whatever/you/like 

Or grant the webserver group (probably www-data write access to the directory:

chgrp www-data /whatever/you/like; chmod g+w /whatever/you/like 

The latter choice may require root privs (if you're not a member of the www-data group), and the former may not work if extended ACLs aren't enabled on your server.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.