Every time i run setup upgrade or static-content deploy command, I need to assign permissions to var, generated, pub/static etc in Ubuntu.
Is there any permanent solution for that so every time we don't have to give permission.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityEvery time i run setup upgrade or static-content deploy command, I need to assign permissions to var, generated, pub/static etc in Ubuntu.
Is there any permanent solution for that so every time we don't have to give permission.
Another solution would be to write a shell script which performs upgrade / static deployment and sets / corrects folder permissions. That way you are only running the shell script.
As requested - something like this
deploy.sh
#!/bin/bash
echo Start
php -v
php -d memory_limit=-1 -d display_errors=on bin/magento setup:static-content:deploy -f
find ./var -type d -exec chmod 777 {} \;
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
echo Finish
root
, you dont have to change permissions, just updated the owner - chown -R user:user *