May I know the permission for the Magento user to run the cmd SSH/putty. I had checked the Magento documentation but I can't understand for which file need to give 777 and which files need to change the permission. Till now I working on sudo su mode only. And how to handle the permission in production and sandbox.
2 Answers
You should set as bellow recommended Permissions.
cd <your Magento install dir>
For files 644 : find . -type f -exec chmod 644 {} \;
For Directory 755 : find . -type d -exec chmod 755 {} \;
For var folder 777 : find ./var -type d -exec chmod 777 {} \;
For pub/media folder 777 : find ./pub/media -type d -exec chmod 777 {} \;
For pub/static folder 777 : find ./pub/static -type d -exec chmod 777 {} \;
For app/etc folder 777 : chmod 777 ./app/etc
For app/etc .xml file 644 : chmod 644 ./app/etc/*.xml
chown -R :<web server group> .
chmod u+x bin/magento
I recommended following the Adobe dev-docs.
Set file permissions
- cd /var/www/html/
- find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
- find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
- chown -R :www-data . # Ubuntu
- chmod u+x bin/magento
Reference: https://devdocs.magento.com/guides/v2.4/install-gde/composer.html