M2: Fix Permissions

Published on 25 Apr 2019 , edited on 29 Apr 2019

Permission issues galore! Take these snippets, it’s dangerous out there!

sudo su - magento
golive
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;
sudo find ./var -type d -exec chmod 775 {} \;    
sudo find ./pub/media -type d -exec chmod 777 {} \;
sudo find ./pub/static -type d -exec chmod 777 {} \;
sudo chmod 777 ./app/etc
sudo chmod 644 ./app/etc/*.xml
sudo chown -R magento .
sudo chmod u+x bin/magento
magento setup:upgrade
magento setup:di:compile
find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
sudo chown -R :www-data .
chmod u+x bin/magento

Snippets

Short notes and snippets as reminders for myself and my work.

All categories

All tags

All posts