We have a Magento website hosted on EC2 and for some reason var folder permissions keep on changing after some time. I think its happening because of magento default cron which runs every couple of hours and it seems it flushes the cache and at that time folder permission gets changed. Because of this website stops working.
Here is the screenshot of the error which we get once permissions are changed:
I am solving this by running chmod command through terminal but this is happening every couple of hours, so we need some permanent solution so that this problem is not repeated.
2
Answers
The probable answer is that the cron job executes under your user – and the directory is owned by apache (or www-data or nobody or whatever user your webserver runs as).
To get it to work, you could set up the cron job to run as the webserver user. Something like this:
Alternatively, you could change the permissions to 775 (read-write-execute for the owner and group, and read-execute for others) and set the group ownership of the folder to the user running the cron job.
I think that you have some permission restriction in your folder, try these commands:
Magento File permissions:
chmod -R 644 ./*
find . -type d -exec chmod 755 {} ;
find . -type f -exec chmod 644 {} ;
chmod 550 ./mage