sudo rm -rf pub/static/*

sudo php bin/magento setup:upgrade

I have set 777 permission to pub but still getting

[Exception] :

Missing write permissions to the following directories: '/var/www/magento2/pub/static'

Suggest some solution.

  • Which command use for set 777 permissions ? Sep 26, 2016 at 4:55
  • @Payal Patel - chmod -R 777 pub the permission is set but then also it gives the error
    – coder
    Sep 26, 2016 at 4:59
  • Use this command @Zest :- sudo chmod 777 -R pub Sep 26, 2016 at 5:00
  • yes I used this command and it is setting permission but still getting error
    – coder
    Sep 26, 2016 at 5:01
  • Unless you really need 2.0.7 (testing an upgrade maybe?) you should just install 2.1.1/latest at this point.
    – MartyS
    Sep 26, 2016 at 9:47

3 Answers 3


Please check this link.

I hope this link helpful for your issue.

Missing write permissions in directory pub/static when run bin/magento setup:upgrade

You can check also below link.

Magento2 Missing write permissions to the following directories: 'site/public_html/pub/static'

  • Thanks I followed the steps but still getting error
    – coder
    Sep 26, 2016 at 5:10
  • Check my update answer and try to follow link @zest. Sep 26, 2016 at 5:15

I think, First you need create Static Content,

 bin/magento setup:static-content:deploy

Then Run,

  chmod -R 777 /var/www.html/
  bin/magento setup:upgrade 

This way worked for me,

 Type sudo chmod 777 -R var pub command in terminal
 then php bin/magento setup:upgrade

hope it will works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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