0

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.

3

2 Answers 2

1

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

Shell example screenshot

7
  • Please, can you share your code on how to do that,
    – Yogesh
    May 18, 2019 at 16:40
  • Updated answer in response to your reply May 18, 2019 at 17:03
  • sure i will check that, thanks a lot
    – Yogesh
    May 18, 2019 at 17:05
  • You can add more to that or edit it to how you work. One command per line. Accept the answer if it works out for you. Forgot to mention make sure that the shell script has execute permission. May 18, 2019 at 17:50
  • this is very bad approach, do not run any commands as root, you dont have to change permissions, just updated the owner - chown -R user:user *
    – MagenX
    May 18, 2019 at 18:32
0

Pls refer devdocs regarding two user here:

1
  • I have referred that and tried to apply solution but facing the same issue, please give a proper answer with step
    – Yogesh
    May 18, 2019 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.