Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

migrated from serverfault.com Jul 6 '13 at 23:57

This question came from our site for professional system and network administrators.

    
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

1 Answer 1

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..
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.