4

Trying to get a basic grasp of ssh and cli on Magento 2.1 to "easily" install themes and extensions, but I'm dead in the water from the get go. I have a working version of 2.1 running on a VPS.

Ran into this error and can't find how to address it before using the Magento Command line.

When trying to access php bin/magento

Any help would be appreciated.

2
  • Have you tried sudo php bin/magento
    – Pawan
    Jan 10, 2017 at 4:10
  • When I do, I get the following: "sudo: effective uid is not 0, is sudo installed setuid root?" I'm not sure what this means or what to do. Jan 11, 2017 at 7:35

2 Answers 2

1

Give full control (read/write/execute) to var directory.

sudo chmod -R 777 var

Or you can run the command using sudo.

sudo php bin/magento {your command}

For more details, refer this link.

0

Usually, this error means that your directory which Magento trying to use has an inappropriate owner. You can check it easily using:

ls -la var/generation

from the Magento root directory. If your web-server user (usually it is www-data user) has no permission to write in this directory (or delete it), you should give those permissions or change an owner, like:

sudo chown -R www-data var/generation

In case you have no permissions to do that, but you have to write permissions you can simply move that directory to some other place and Magento will regenerate it during the next call to a cli.

Note: in case many users will work with those files, you can use a group and add write permissions to a group. Set write permissions for Others (all users) is not a good idea.

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.