部署Symfony3 Web应用程序时的Jenkins权限(清除缓存)

I'm deploying a Symfony3 application via Jenkins on Ubuntu. I'm clearing the cache by running the cache:clear --env=prod command after all the other commands (using shell command in Jenkins).

After clearing the owner of the new cache files is Jenkins, so my Symfony3 application does not load via browser telling me it has no permission to work with the cache and logs folders.

How can I make Jenkins clearing the cache and return the folders owner to www-data?

I don't use Jenkins but if you make a mini shell script with :

chown -R root:www-data /var/www/xxx

And you run it at the end of your installation ?

The answer is: you should discover for yourself setfacl in linux. It allows you to add users and groups for read, write and execute. Solved all the problems for me. No more owner problems.