When running:

root@ubuntu:/var/www/Magento2# bin/magento setup:static-content:deploy

I got

-bash: bin/magento: Permission denied

please note that I'm running the command using root user

  • What is the output of ls -l bin/magento? Commented Feb 23, 2016 at 12:14
  • Please provide execute permission to for it even for ROOT user. chmod -x bin/magento Commented Feb 23, 2016 at 12:21
  • use like php bin/magento setup:static-content:deploy The php need to be added before bin/magento
    – Ashish Raj
    Commented Jan 2, 2018 at 6:45

4 Answers 4


You can also try php bin/magento setup:static-content:deploy


Use word php before the command

php bin/magento setup:static-content:deploy

Refer : Devdocs : static contents


As already mentioned in the comments:

Check the permission of the file like so:

ls -lah bin/magento

You will see that the execute permissions are missing. Therefore add the execute permissions like so:

chmod +x bin/magento

If you don't want to allow execution for that script, you can run the script with your local php installation like so:

php bin/magento ...

Nevertheless you should not run any command as root.


In order to fix permissions, you can run all of these commands, or at least the last two since it is not mentioned that you've configured permissions on app/:

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find ./var -type d -exec chmod 777 {} \;
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml

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.