Symfony Permission Denied

Symfony permission denied

You can take a look at http://symfony.com/doc/current/book/installation.html on "Setting up Permissions" section. It talks about app/logs and app/cache, but you can do the same on any other folder you need

Error with Symfony's cache and permissions

You need to set the var folder permissions as suggested by this symfony article.

Run the following commands in your project directory and you will not come across any permission related issues on cache and logs

HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1)
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var

Docker execution of Symfony commands: Permission denied

As you can see on https://hub.docker.com/_/php/, the docker image you are using (php:fpm) does not contain the CLI version, so you should use another image.

And as Docker allows you to do that, you might use a completely different container to run the CLI version side to side the container running the webserver, with the common directories mounted to both containers. This helps you to better seperate the different parts

EACES permission denied when trying to launch an installed Symfony Akeneo PIM with Docker

Maybe you allready figured it out by your self but for the record:

When running

docker-compose run node ls -lah /home/node

you see that .yarn has root ownership. You can change it by running:

docker-compose run -u root node chown -R node:node /home/node/.yarn

After that you should be able to run make properly.

Permission denied when executing Symfony Demo app through Docker

On second thoughts: my previous solution (as is) doesn't work in RHEL/Fedora/CentOS, because www-data does not exist there by default, causing Docker to fail to start.


My new solution - distro agnostic

For simplicity, I've decided to simply write composer's entrypoint script to set -rw-rw---- permissions at /app. That way, I can run composer as user 1000 and the same group PHP runs as (a new user and group was created just for that). Now PHP can write to SQLite3 database files inside the project and composer writes as user 1000, which I can edit.

It's basically what @habibun said, but I only need to give group write permissions, not full write permissions.

Be aware that SELinux will deny composer write access to your bind mount. You must configure SELinux to allow this operation.

This is my repository where this project is stored, if you're looking for a reference: https://github.com/o-alquimista/symfony-demo-docker/


User namespace solution - works fine for Debian/Ubuntu hosts

Composer should write to /app as user 33 (www-data), and so should php and httpd after they drop privileges. I was able to keep present permission settings (only owner can write) by making use of user namespaces. The user www-data is now mapped to the range 967 and beyond, which will result in user 33 being = me (user 1000).

Now all containers can write where they need to, and I can edit the project files as an unprivileged user.



Related Topics



Leave a reply



Submit