I'm running the command bin/magento deploy:mode:set: developer inside a docker container.

It's outputting the same error below for many files.

The "/var/www/html/var/cache/mage--7/mage---792_MAGE_VERSION" file can't be deleted. Warning!unlink(/var/www/html/var/cache/mage--7/mage---792_MAGE_VERSION): Permission denied

What I tried:

  • chmod -R 777 var/cache (outputs error operation not permitted)
  • change permission for var pub and generated. Sudo chmod -R 777 var pub generated
    – S.P
    Jul 22, 2022 at 13:33
  • permission with super user. sudo chmod -R 777 var pub generated.
    – S.P
    Jul 22, 2022 at 13:34
  • When I try to log as super user using su - it asks for a password. Is there a default? Jul 22, 2022 at 13:36
  • yes it is default password. for your syste,
    – S.P
    Jul 22, 2022 at 13:40
  • instead of su - Use command with sudo. Ex sudo chmod -R 777 var pub generated
    – S.P
    Jul 22, 2022 at 13:41

1 Answer 1


You should apply proper permission to pub var and generated folder.

execute below command.

sudo chmod -R 777 var pub generated

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.