WSL: mkdir: cannot create directory ‘a’: Permission denied

Cannot create directory with mkdir even though touch, rm, rmdir, mv all works fine.

Microsoft Windows [Version 10.0.19546.1000]

Arch Linux distro created with wsl --export Arch D:\arch.tar wsl --import Arch2 D:\WSL\Arch2 D:\arch.tar --version 2

cd /mnt/d/ mkdir a gives mkdir: cannot create directory ‘a’: Permission denied

Works fine at home directory though cd /mnt/c/Users/user mkdir a no problem here…

Where should I start to look for a solution for this?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 23 (1 by maintainers)

Most upvoted comments

try command sudo chown -R "yourusername" . replace “yourusername” with the name of the user

In my case it was a mount issue, or at least changing the mount options fixed it. Running the following command from https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/ worked for me:

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

It’s unclear but the command seems to be permanent. I’m not sure what happened during the upgrade from WSL 1 to 2 that affected this.

Turns out my mount solution didn’t last through a reboot, but the Full Control to users fixed it, thanks @stu85010.

Hello there,

In my case, this issue was solved by: giving the Full control permission to your Windows account for this directory with Security tab image

Said, I’d created a directory at /c/src and trying to develop there, but the “User” group doesn’t have Full control permission at that path, so the folder creation is failed in WSL in my case.

Then I was added the Full control permission to my Windows account at that folder, and the mkdir worked perfectly in that directory.

I just upgraded to ubuntu version 2 and I’m getting the same issue. I can’t mkdir on my drives in /mnt/c and /mnt/d, but it works fine in my home folder and other areas. All other operations work fine. Even running with sudo doesn’t help. My app that I’m working on also can’t create folders.