cancel
Showing results for 
Search instead for 
Did you mean: 

Website Permission Issue After weekends

Website Permission Issue After weekends

Hi,

I am Shabbir Vejlani.I have a webiste which is hosted on a Aws instance.The website is developed on Magento 2.0.

There is some strange issue with magento or the cron jobs maybe!

After every weekend, cache folder inside var directory is recreated, and the permission and ownership is over-written.

The owner is changed to root and permission is set to 775.

 

And due to this the product category page shows up an error stating that - Unable to write file into /var/cache/ directory.

I am certain that, there is some cron job running on weekends that is causing this, but i am not able to identify that cron job and also the purpose of that cron.

 

Can anyone help me out with the issue? I have been struggling with these from a long time.

 

Any advice and help will be appriciated.

 

 

Thanks

Shabbir Vejlani

5 REPLIES 5

Re: Website Permission Issue After weekends

@vejlanishac5b6 

 

For now you can do a setup new cron to allow permission 777 and required owner, it should help you

 

Manish Mittal
https://www.manishmittal.com/

Re: Website Permission Issue After weekends

Hi,

So is it a optimal solution for this problem?

As i do not know when that cron runs and changes the permission for cache folder.

The only thing i know is that it runs somewhere around the weekends, most probably on Saturday.

 

So should i set a cron to run every minute or hour on Saturday, to change the permission and ownership.

 

Will that be optimal?

 

Thanks

Shabbir

Re: Website Permission Issue After weekends

@vejlanishac5b6 

 

Yes do it for now to solve your problem later you can ask your server team they will help you to do set permanent permission to your folders.

Manish Mittal
https://www.manishmittal.com/

Re: Website Permission Issue After weekends

Hi,

I did set the permanent permission for the folders as 777 but it is getting over-written by the cron job.As the cron job runs as root, it again changes the permission for the folders.

This is what i do when the permission has bee n reset

-> sudo chmod -R 777 var

I also tried this

-> sudo chown www-data:www-data var

Both the above solution stays until the next weekend.As the cron runs again, it is over-written.

Re: Website Permission Issue After weekends

Hello @vejlanishac5b6 

 

How frequent you have set your cron?

 

You can follow:

find . -type f -exec chmod 664 {} \;
find . -type d -exec chmod 775 {} \;
find var pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
chmod u+x bin/magento

 

Here is the official document:

https://devdocs.magento.com/guides/v2.3/config-guide/prod/prod_file-sys-perms.html 

Manish Mittal
https://www.manishmittal.com/