WSL: Permission Denied For Folders in Mounted VHDX/VHD in WSL

I have created a VHDX/VHD (GUID/MBR type) file in Windows 10. It is mounted as an NTFS formatted drive with drive letter X:. When I open the bash (Ubuntu on Windows 10/WSL), I am able to cd /mnt/x However, when I do ls, i get permission denied for all the files. Also, I am not able to create directory even with sudo. Same problem with chmod, chown, etc.

I have also tried to grant permissions to everyone through icacls in Windows through command line as well as through the GUI.

Attached the screenshots below:

Windows Explorer

Windows UI ### Bash Bash ### Bash - Displaying permissions permissions

I think the problem is that the way NTFS gets mounted on Windows. The mounted mode is being treated as a read-only mode by the Ubuntu Bash.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 6
  • Comments: 51 (16 by maintainers)

Most upvoted comments

@sunilmut – just verifying – did you notice that this is not a regular bug report, it’s a regression report?

If a hotfix to Anniversary inadvertently breaks part of WSL, what’s your policy on fixing it? I would advocate that such fixes should be prioritized if at all possible – y’all want people applying your hotfixes, and they’re not going to if hotfixes introduce regressions and start being perceived as risky.

@Manouchehri I’m surprised you’re able to see VHD’s at all in bash. I thought we only exposed fixed NTFS drives.

I started running into “Permission denied” issues once I upgraded to the Creators Update (everything was working fine before), then I started seeing things like:

$ ls data/h2
ls: cannot open directory data/h2: Permission denied

I found a strange “Deny” entry in the folder’s permission in Windows Explorer (Right Click > Properties > Security > Advanced) denying my account “Special” access. Below it was an identical looking “Allow” entry. Removing the “Deny” entry allowed Bash to access the directory again.

I’m not sure where that entry came from, but I don’t think it’s related to WSL (it does seem new with the Creators Update though). I just wanted to share that troubleshooting step here since I initially thought it was a WSL issue. I could still access the directory normally from Explorer, so it might only crop up for people using Bash.

I had a word about this with the team. It appears that this is a known issue, and, regressed because of an update outside of WSL. Irrespective, we understand that this is a regression. Unfortunately, and as I have been informed, the bug bar to get this fixed in Anniversary Update is high and this won’t make the cut. Also, because the Creators Update release is around the corner which has a fix for this. We do owe an apology here.

The permissions seem to be identical between my VHD and physical partition, but WSL cannot access the VHD.

PS T:\> [Environment]::OSVersion

Platform ServicePack Version      VersionString
-------- ----------- -------      -------------
 Win32NT             10.0.14942.0 Microsoft Windows NT 10.0.14942.0

VHD

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS T:\> icacls T:\
T:\ BUILTIN\Administrators:(F)
    BUILTIN\Administrators:(OI)(CI)(IO)(F)
    NT AUTHORITY\SYSTEM:(F)
    NT AUTHORITY\SYSTEM:(OI)(CI)(IO)(F)
    NT AUTHORITY\Authenticated Users:(M)
    NT AUTHORITY\Authenticated Users:(OI)(CI)(IO)(M)
    BUILTIN\Users:(RX)
    BUILTIN\Users:(OI)(CI)(IO)(GR,GE)

Successfully processed 1 files; Failed processing 0 files
dave@universal:~$ df -h /mnt/t
Filesystem      Size  Used Avail Use% Mounted on
T:              997M   15M  983M   2% /mnt/t
dave@universal:~$ mount | grep '/mnt/'
C: on /mnt/c type drvfs (rw,noatime)
G: on /mnt/g type drvfs (rw,noatime)
T: on /mnt/t type drvfs (rw,noatime)
dave@universal:~$ ls -l /mnt/t/
ls: cannot access /mnt/t/$RECYCLE.BIN: Permission denied
ls: cannot access /mnt/t/System Volume Information: Permission denied
ls: cannot access /mnt/t/usertest: Permission denied
total 0
d????????? ? ? ? ?            ? $RECYCLE.BIN
d????????? ? ? ? ?            ? System Volume Information
d????????? ? ? ? ?            ? usertest
dave@universal:~$ touch /mnt/t/test.txt
touch: cannot touch ‘/mnt/t/test.txt’: Permission denied

Physical Partition

G:\ BUILTIN\Administrators:(F)
    BUILTIN\Administrators:(OI)(CI)(IO)(F)
    NT AUTHORITY\SYSTEM:(F)
    NT AUTHORITY\SYSTEM:(OI)(CI)(IO)(F)
    NT AUTHORITY\Authenticated Users:(M)
    NT AUTHORITY\Authenticated Users:(OI)(CI)(IO)(M)
    BUILTIN\Users:(RX)
    BUILTIN\Users:(OI)(CI)(IO)(GR,GE)

Successfully processed 1 files; Failed processing 0 files
dave@universal:~$ df -h /mnt/g
Filesystem      Size  Used Avail Use% Mounted on
G:              7.9G   29M  7.8G   1% /mnt/g
dave@universal:~$ mount | grep '/mnt/'
C: on /mnt/c type drvfs (rw,noatime)
G: on /mnt/g type drvfs (rw,noatime)
T: on /mnt/t type drvfs (rw,noatime)
dave@universal:~$ ls -l /mnt/g/
total 64
drwxrwxrwx 0 root root 0 Oct  4 13:53 $RECYCLE.BIN
d--------- 0 root root 0 Oct  4 15:20 System Volume Information
dave@universal:~$ touch /mnt/g/test.txt
dave@universal:~$ ls -l /mnt/g/
total 64
drwxrwxrwx 0 root root 0 Oct  4 13:53 $RECYCLE.BIN
d--------- 0 root root 0 Oct  4 15:20 System Volume Information
-rwxrwxrwx 1 root root 0 Oct 14 10:41 test.txt

anyone any idea if this will ever be fixed ?

I see it’s still present in KB3213986