For anyone installing install Craft on WSL (Windows Services for Linux)...

WSL has enough traction with developers that I decided to take the dive, but I'm having trouble getting permissions straight with my Craft install.

Apparently, PHP doesn't have permission to chmod inside the project folders, which generates this error on login to Craft.

Failed to change permissions for directory "/mnt/c/Users/jimme/sites/mywebsite/craft/web/cpresources/6d799f01": chmod(): Operation not permitted

Caused by: yii\base\ErrorException chmod(): Operation not permitted in /mnt/c/Users/jimme/sites/jm/vendor/yiisoft/yii2/helpers/BaseFileHelper.php >at line 646


I've modified my /etc/wsl.conf file to add support for linux metadata, which allows permissions to be set granularly for files in the windows filesystem. I've also changed changed the ownership to myuser:www-data and added group write perms. After making this change it fixed the above error but now I'm getting this on login...

HTTP 400 – Bad Request – yii\web\BadRequestHttpException Unable to verify your data submission.

in /mnt/c/Users/jimme/sites/jm/vendor/yiisoft/yii2/web/Controller.php

any ideas?

2 Answers 2


This worked well for me!

Be sure to change directory out of the drive you want to unmount first!

Just to keep it all together here is what you need to do -

sudo nano /etc/wsl.conf

Paste this into the open file -


Then paste and enter these one at a time into Terminal -

sudo rm /your_craft_path_to/cpresources

cd /var/www

sudo umount /mnt/c

sudo mount -t drvfs C: /mnt/c -o metadata

sudo service apache2 restart

Head to your Craft URL and et voila!

  • Thank you, this works
    – Permana
    Commented Nov 8, 2020 at 18:45

All fixed. The solution was to add these mount options to /etc/wsl.conf to allow metadata support. Also had to rename (or delete) /storage/cpresources and clear cache.


From Microsoft on permissions in WSL: https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/

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.