0

I am having some issues with my magento 2.3.1 stored on a ubuntu 16.04 server . each time i run php bin/magento setup:upgrade, the VAR and GENERATED folder always loses its permission until i run sudo chmod 777 -R var/ pub/ generated/ to give it full permissions but this keeps bugging out.

I am thinking of using

  1. CRON to run a script that will run every minute that will give the folders full permission. or
  2. using HTACCESS to get this done. [using https://stackoverflow.com/questions/10086989/htaccess-file-to-allow-access-to-images-folder-to-view-pictures]

So far, Nothing is working fine

2 Answers 2

0

This is help you may be try this :-

Use The following commands to set permissions, it may help

find . -type f -exec chmod 644 {} \;  
find . -type d -exec chmod 755 {} \;     
find ./var -type d -exec chmod 777 {} \;     
find ./media -type d -exec chmod 777 {} \;   
chmod 777 ./app/etc              
chmod 644 ./app/etc/*.xml 

Any more information, which file which permission apply so read this link may be help you :-

Magento 2 folder/file permissions

Any query let me know

Thanks.

4
  • when i use php bin/magento setup:upgrade to install and extension, the entire permission crashes. I need a formular that will guarantee that the VAR/ and GENERATED/ folders are set to the same 777 permission. can i use HTaccess pr use cron or any other method to ensure it stays so Apr 17, 2020 at 14:08
  • this is best way, i think you take server side help Apr 17, 2020 at 17:26
  • please explain more Apr 18, 2020 at 13:32
  • i think you take server support because your server missed some configuration Apr 18, 2020 at 14:02
0

Most likely, the reason is that you're running the setup:upgrade command with a different user than the webserver and / or cron uses.

Basically, as soon as you have to 777 anything, your server setup has a flaw somewhere.

There's a detailed description on how to setup users and permissions in the official docs: https://devdocs.magento.com/guides/v2.3/config-guide/prod/prod_file-sys-perms.html?itm_source=devdocs&itm_medium=quick_search&itm_campaign=federated_search&itm_term=permission

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.