so I am running a magento 2.2.4 in development and one in production, the dev is ok and I can do all, the production is an exact copy of it on apache 2.4 and Ubuntu 16.04, every time I use any kind of cli command (grunt, setup, whatever ) to regenerate the static file I got a blank page and to put all in place again I have to run chown -R www-data:www-data /.

I am sure the cli user belongs to the www.data group

2 Answers 2


My workaround is to set www-data as primary your user group.

sudo usermod -g www-data yourusername

It will cause all of the files will be in www-data group by default. But keep it in mind, even those you wouldn't like to share in this group.

  • already tried this and it does not work, which is strange Commented Oct 19, 2018 at 7:13
  • I actually tried this again lately and it solved the problem, maybe I had a typo before so this is the answer to the problem, thanks! Commented Nov 16, 2018 at 14:55

I don't know what is the user that you are using to run the command, but based on your information it's not www-data.

I suggest you run the command always as www-data.

sudo su -u www-data <command>

This will make sure you are always running the command as www-data.

  • I actually do this, but this is not a solution, mostly cause most of the process is autmated and not executed manually, so the only solution would be to write a single bash, but still I would like to solve the problem and use no hack Commented Oct 19, 2018 at 7:13
  • check if Magento cronjob is running as www-data Commented Oct 19, 2018 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.