12

so I installed this Windows 10 feature since I miss the terminal/bash available on OS X.

One quirk I noticed is that all the files in my data drive (separate HDD from my OS drive) are owned by root. I tried changing ownership to my user (via chown -R my-user-here:root /mnt/d/my-stuff/*) but nothing happens.

I ran

ls -la

and the ownership hasn't changed.

Any way of fixing this?

Thanks

mrjayviper
  • 1,555
  • In this case, no output is good output. If everything completed successfully, chown won't give any output. – You'reAGitForNotUsingGit May 04 '17 at 12:51
  • "but nothing happens." General idea in Linux: if all went well do not report back to the user. Only report back when there is a problem. – Rinzwind May 04 '17 at 14:35
  • @AndroidDev Apologies I wasn't clear. When I said nothing happened, I meant I did an "ls -la" afterwards and the ownership is still the same. Thanks again – mrjayviper May 04 '17 at 23:45
  • Supposedly there is now experimental support for this: https://docs.microsoft.com/en-us/windows/wsl/release-notes#build-17063 – mikebridge Feb 22 '18 at 21:01

2 Answers2

16

This is now already fixed via mount "metadata" option. All you need do is add a file /etc/wsl.conf (if it does not exist) and add this content to it.

[automount]
enabled = true
options = "metadata"
mountFsTab = false

You would need to restart windows for it to take effect. Further details can be found on the same issue but most recent comment https://github.com/Microsoft/WSL/issues/81#issuecomment-400597679

Aftab Naveed
  • 276
  • 2
  • 5
  • Terminating the distribution and restarting it is actually sufficient: https://superuser.com/questions/1126721/rebooting-ubuntu-on-windows-without-rebooting-windows – Oliver Salzburg Jun 25 '20 at 17:05
  • 1
    From @OliverSalzburg 's comment and link, closing the terminal windows is not enough, one must run 'wsl.exe --shutdown' from the windows cmd or powershell to kill all background processes...then apparently have to wait 8 seconds because...Windows. – topher217 Apr 14 '22 at 05:51
3

According to https://msdn.microsoft.com/en-au/commandline/wsl/faq:

Files in mounted drives are controlled by Windows and have the following behaviors:

  • Support case sensitivity
  • All permissions are set to best reflect the Windows permissions

I believe this issue is a won't fix. You'll need to use Windows to modify permissions in the mounted drives, or find some other ways to do what you needed to do like copying the file over.

Lie Ryan
  • 652