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
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
Explore related questions
See similar questions with these tags.
ls -l bin/magento?executepermission to for it even forROOTuser.chmod -x bin/magento