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

LoudHouse Family
  • 69
  • 1
  • 1
  • 12

2 Answers2

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.

Mohit Patel
  • 3,778
  • 4
  • 22
  • 52
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

simonthesorcerer
  • 4,813
  • 2
  • 19
  • 32