When I run any M2 command line scripts I get the follow error message:

Command line user does not have read and write permissions on var/generation directory.  Please address this issue before using Magento command line.

My user is a part of the group with admin rights and the file owner.

May I ask where else to check?

  • in your command line run chmod g+s var/generation which should give you the access you need Sep 13, 2017 at 21:18

1 Answer 1


Yeah, it's a file permission error.
In case if you are ubuntu user, then you can run the following commands:

cd /path/to/magento2/
sudo chmod -R 777 var/
sudo chown -R www-data:www-data var/
  • The user "www-data" does not exist. Is that a separate issue? Apr 12, 2017 at 14:27

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.