Ubuntu for Windows 10: All files are own by root and I cannot change it

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


Solution 1:

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

Solution 2:

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.