Search code examples
linuxpermissionssymfony-cmf

Permission issue with 'app' folder using Symfony CMF


I just installed Symfony CMF (standard edition 1.1) on a Linux VPS running Ubuntu 13. Everything is installed without errors but I always end up with a permission problem regarding the /app/cache & /app/logs folder.

As far as I know I installed the CMF as user root and the frontend is using user www-data, The only way to get it working without problems is by using these commands;

sudo chown -R :www-data app
sudo chmod g+s app
sudo setfacl -dR -m g::rwX app
chmod -R 777 app

After that it works perfectly but I am sure that from a security point of view this is not the correct way to do this.

So, I hope that anyone who has experienced this problem can provide me with a secure and correct method of solving the /app/ permission problem.

If I need to provide more information or show some configurations, I will gladly provide it as I need to solve this minor issue that is blocking the launch of my project.


Solution

  • This is explained in detail in the symfony documentation. Note that for images, we use the Imagine bundle, so you also need to set permissions on web/media/cache.

    Usually you do not want to do things like deployments or git checkout as root, but with a non-privileged user. It is a good idea to have the webserver run under a different user, so that it can not just edit PHP files, to limit the potential damage in case there is a security issue in the webserver or your application.