I have a Symfony2 project that needs full read write permissions to three directories: app/cache, app/logs, and few other directories which are used for uploading. The problem is everytime I push an update via git these libraries lose their permissions and I have to runa chmod 777 on them.

I'd like to not have to do this everytime. I could just write this in the hooks/post-receive but I'd like to know if there's a better way to do it and if giving 777 permissions is ok. It is the only way the project works.

Please advise.

  • Thanks for the answer. I'm not really super Linux savvy, I always thought read write is 777. I'll change that. Learnt something new today. Thanks! So do you also have any ideas to make these permissions permanent? – Aayush Jul 4 '13 at 8:48

Do you need the mode to be 777? (Read that as "You really don't want the mode to be 777")

You don't want any user (remote or local) to be able to execute a cache, log or uploaded file.

If those directories are owned by the same user as the one running your webserver application (apache, nginx, cherokee), then you should be able to get away with 664.

By "making the permissions permanent".. I'd do one of two things.

  1. Use git-cache-meta
  2. Use a deployment tool, such as Fabric, Capistrano or $something_else to deploy the application from git, set permissions, restart services etc..

Your Answer

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