WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Mount permissions prevent interop

Open mkarpoff opened this issue 7 years ago • 5 comments

Please fill out the below information:

  • Your Windows build number: (Type ver at a Windows Command Prompt)

17763

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)

I'm trying to run some windows commands in ubuntu (clip.exe specifically but all win commands do the same thing). I ran into permission errors. Interop is enable but the problem is that I mount C:> with the options=metadata,umask=22,fmask=111.

  • What's wrong / what should be happening instead:

The problem is that mount options set the default file permissions to be non executable for windows programs but if you try to manually give the file bash executable permissions it doesn't allow that either. Ex. sudo chmod +x /mnt/c/Windows/System32/clip.exe throws chmod: changing permissions of '/mnt/c/Windows/System32/clip.exe': Permission denied

Here is how my /etc/wsl.conf is setup

[automount]
#This Mounts the drives (pretty sure this is default)
enable=true
#metadata: save file metadata (otherwise it makes it 777)
#masks (Sets them to Ubuntu defaults) make them whatever you want
options=metadata,uid=1000,gid=1000,umask=22,fmask=111
[interop]
# enable launch of Windows binaries; default is true
enabled=true
# append Windows path to $PATH variable; default is true
appendWindowsPath=true

mkarpoff avatar Dec 14 '18 20:12 mkarpoff

You (your Windows user) don't have permission to modify files, including the metadata, in C:\Windows\System32. By extension neither does your WSL user, which is not granted special powers to do so. You'll note the perms are -r- (lacking w). That much is by design.

Copy&paste specific commands and their output, or include screen shots)

They would have looked like:

image

therealkenc avatar Dec 14 '18 22:12 therealkenc

The problem I'm having is that my mount settings are the same as you're in that example but when I run ls -l /mnt/c/Windows/System32/clip.exe I get -r--r--r-- 2 mkarpoff mkarpoff 30720 Sep 15 01:29 /mnt/c/Windows/System32/clip.exe With the executable permission missing

mkarpoff avatar Dec 14 '18 22:12 mkarpoff

Sorry that was my bad. I did more than one run and pasted from the wrong place (I need to stop doing these in a rush). Yes those are the correct perms with umask=111. Fixed up the above post with a screencap instead. Yes, you will not get x. Because you've masked it. You don't have w because you don't have permissions. That leaves you with r.

therealkenc avatar Dec 14 '18 23:12 therealkenc

Is there some way to mount parts of the drive with separate permissions?

mkarpoff avatar Dec 15 '18 05:12 mkarpoff

Yes. Mount C: on two mountpoints with different permissions and use a bind mount for the part you want. You can set these up in your fstab(5) (see also mountFsTab=true per this blog post). Not that I think you need to or should do this, but you asked. Bonne chance.

therealkenc avatar Dec 15 '18 07:12 therealkenc