symfony icon indicating copy to clipboard operation
symfony copied to clipboard

Permission issue using ACL

Open yellowmamba opened this issue 8 years ago • 3 comments

Hi there,

I use ACL to set permissions on certain directories upon deployment. Here's the part of deploy.rb:

set :linked_files, ['app/config/parameters.yml']
set :linked_dirs, ["app/logs", "web/uploads"]

set :permission_method, :acl
set :file_permissions_paths, ["app/logs", "app/cache", "web/uploads"]
set :file_permissions_users, ["www-data"]

before "deploy:updated", "deploy:set_permissions:acl"

So this works on the first deployment, when you set up your directories where nothing has been created inside them yet. However, after some time, say you uploaded an image to the web/uploads directory, the file would be under the www-data user, while the directory is still owned by the deploy user. So when you deploy code again, capistrano will fail because it attempts to run acl on a directory that contains files owned by www-data.

How can I work around this?

yellowmamba avatar Jul 04 '16 06:07 yellowmamba

Hello, I have exactly the same problem. I tried using chmod, works fine first time, but capistrano can not delete old releases because cache directory contains files owned by www-data.

Really appreciate if someone can help with that.

wasbaiti avatar Oct 25 '16 09:10 wasbaiti

@wasbaiti I don't have this issue on deleting old releases due to the cache folder. Did you set up permissions correctly? http://symfony.com/doc/current/setup/file_permissions.html. Note you need to give permissions to both web server user and your whoami user for cache and/or log folder.

yellowmamba avatar Oct 26 '16 04:10 yellowmamba

@yellowmamba : I did set up permissions for my first release, capistrano did delete this release, bun fail to do same thing on other releases. to work around the problem, I add a task that executes commands explained in the documentation and now it works fine. I noticed that the difference is in the command options. That of Capistrano, used -n and without this option it works

wasbaiti avatar Oct 26 '16 07:10 wasbaiti