How to modify permissions for files under /mnt/c in WSL

You need to unmount /mnt/c and mount /mnt/c again with below options :

sudo umount /mnt/c

sudo mount -t drvfs C: /mnt/c -o metadata,uid=1000,gid=1000,umask=22,fmask=111

To automatically unmount and mount the C:\ drive (/mnt/c) , add the below lines to /etc/wsl.conf in WSL.
If wsl.conf does not exist, create it.

[automount]                                                                                                                                      enabled = true                                                                                                                                                     
options = "metadata,uid=1000,gid=1000,umask=22,fmask=111"

Now you will be able to use chmod/chown to modify the permissions on the files under /mnt/c

Leave a comment

Design a site like this with WordPress.com
Get started