<p>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.</p>

<blockquote>
  <p>[automount]<br>
  enabled=true<br>
  options=metadata,uid=1000,gid=1000,umask=022</p>
</blockquote>

<p>From Microsoft on permissions in WSL:
<a href="https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/" rel="nofollow noreferrer">https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/</a></p>

CC BY-SA 4.0
2019-09-09T14:44:56.410Z
2019-09-10T13:45:19.370Z
2019-09-10T13:45:19.370Z
Jim
<p>This worked well for me!</p>
<p>Be sure to change directory out of the drive you want to unmount first!</p>
<p>Just to keep it all together here is what you need to do -</p>
<blockquote>
<p>sudo nano /etc/wsl.conf</p>
</blockquote>
<p>Paste this into the open file -</p>
<pre><code>[automount]
enabled=true
options=metadata,uid=1000,gid=1000,umask=022
</code></pre>
<p>Then paste and enter these one at a time into Terminal -</p>
<blockquote>
<p>sudo rm /your_craft_path_to/cpresources</p>
<p>cd /var/www</p>
<p>sudo umount /mnt/c</p>
<p>sudo mount -t drvfs C: /mnt/c -o metadata</p>
<p>sudo service apache2 restart</p>
</blockquote>
<p>Head to your Craft URL and et voila!</p>

CC BY-SA 4.0
2020-11-08T18:45:23.020Z
Thank you, this works
Permana
CC BY-SA 4.0
2019-10-10T00:08:03.177Z
2019-10-10T00:08:03.177Z
2020-06-17T08:56:27.903Z
Steven Hambleton
<p><em>For anyone installing install Craft on WSL (Windows Services for Linux)...</em></p>

<p>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. </p>

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

<blockquote>
  <p>Failed to change permissions for directory
  "/mnt/c/Users/jimme/sites/mywebsite/craft/web/cpresources/6d799f01":
  chmod(): Operation not permitted</p>
  
  <p>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</p>
</blockquote>

<p>UPDATE:</p>

<p>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...</p>

<blockquote>
  <p>HTTP 400 – Bad Request – yii\web\BadRequestHttpException Unable to
  verify your data submission.</p>
  
  <p>in /mnt/c/Users/jimme/sites/jm/vendor/yiisoft/yii2/web/Controller.php</p>
</blockquote>

<p>any ideas?</p>

<craft3><error-message><permissions><windows>
Craft on WSL permissions error
# Craft on WSL permissions error

(Asked by: username_0 on 2019-09-06)

*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

UPDATE:

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?

**Tags:** craft3, error-message, permissions, windows

---

## 2 answers

### Answer by username_0 on 2019-09-09. Score: 1 | Accepted answer

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.

> [automount]  
> enabled=true  
> options=metadata,uid=1000,gid=1000,umask=022

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


---

### Answer by username_1 on 2019-10-10. Score: 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 -
[automount]
enabled=true
options=metadata,uid=1000,gid=1000,umask=022

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!

> **Comments:**
> **username_2**: Thank you, this works  

---

