find . -type f -exec chmod 644 {} ;
find . -type d -exec chmod 755 {} ;
find var pub/static pub/media app/etc generated/ -type f -exec chmod g+w {} ;
find var pub/static pub/media app/etc generated/ -type d -exec chmod g+ws {} ;
chown -R <Magento user>:<web server group> .
chmod u+x bin/magento
sudo chmod -R 777 var/;sudo chmod -R 777 pub/;sudo chmod -R 777 generated/;