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? – Renon Stewart Feb 23 '16 at 12:14
  • Please provide execute permission to for it even for ROOT user. chmod -x bin/magento – Praful Rajput Feb 23 '16 at 12:21
  • use like php bin/magento setup:static-content:deploy The php need to be added before bin/magento – Ashish Raj Jan 2 '18 at 6:45

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

| improve this answer | |

Use word php before the command

php bin/magento setup:static-content:deploy

Refer : Devdocs : static contents

| improve this answer | |

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.

| improve this answer | |

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
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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