To build on @ChadT's helpful answer, here's what worked for me.
Open your distro, and create or modify the /etc/wsl.conf
file to include the automount
options below:
$ cat /etc/wsl.conf
[automount]
options = "metadata,umask=022,fmask=111"
These options ensure that files in the mounted system are given proper user and group ownership, and that they have sensible default permissions (as opposed to everything getting 777
).
Close the distro, wait about 10 seconds for the background subsystem to stop running, and reopen the distro.
Navigate to your mounted C: drive at /mnt/c/Users/<user>
, and set the proper permissions on the .ssh
directory and key files, as required by SSH:
$ cd /mnt/c/Users/<user>
$ chmod 700 .ssh
$ chmod 600 .ssh/id_rsa
$ chmod 644 .ssh/id_rsa.pub
Finally, navigate to your distro's home drive, backup or remove any existing .ssh
directory, and create a symlink back to your C: drive's .ssh
directory:
$ cd ~
$ mv .ssh .ssh_orig
$ ln -s /mnt/c/Users/plw1845/.ssh/ .ssh
You should now be able to fully share your Windows SSH config, hosts, and keys with your WSL distro, while maintaining them in a single place.