WSL drvfs mount issues — user mapping not recognised?
Emily Wong
I'm having a couple of issues with mounting drives in WSL (Win10 Linux Subsystem) -- see separate question about a mount error on a different drive.
I have a network share mounted on drive W: locally - and I have read/write access in Windows.
Mounting this drive with drvfs works fine:
$ sudo mount -t drvfs W: /mnt/w
But - when I want to access the drive:
( -/- ) e514678@K46290: ~ $ ls -l /mnt/w ls: cannot access '/mnt/w/bar': Permission denied ls: cannot access '/mnt/w/baz': Permission denied ls: cannot access '/mnt/w/foo': Permission denied total 0 d????????? ? ? ? ? ? bar d????????? ? ? ? ? ? baz d????????? ? ? ? ? ? foo ( -/- ) e514678@K46290: ~ $
Again - on Windows I can access the drive, and the subdirectories on the drive. Mounted using drvfs, I can see the toplevel entries on the drive, but they seem to be missing user & permission information; and so I can't access any of the files from linux either.
Accessing files on a couple of other network shares works fine - but I'm stumped about what's different with this one.
Any ideas as to what might be different with this network volume? (Trying to mount it with specific uid/gid doesn't help: 'sudo mount -t drvfs -ouid=1000,gid=1000 W: /mnt/w' linux still can't access the drive -- with the same issue).
11 Answer
I had the same issue.
I found WSL introduced /etc/wsl.conf since Windows Build 17093.
Please read the details in here:
This is a simple example that might fix your problem:
$ cat /etc/wsl.conf
[automount]
enabled=true
options=metadata,uid=1000,gid=1000,umask=022I found the example above from here: WSL mounted file permissions
After creating or modifying the file, you need to restart WSL.