can I share my SSH keys between WSL and Windows?
What am I doing wrong?
SSH requires sane permissions on the private keys and you are not able to achieve that while symlinking to different filesystem (windows). The manual page for ssh
explains that quite clearly:
~/.ssh/id_rsa
Contains the private key for authentication. These files contain sensitive data and should be readable by the user but not accessible by others (read/write/execute). ssh will simply ignore a private key file if it is accessible by others.
You can most probably copy the private keys and set appropriate permissions, if you want to "share the keys".
You need to mount your windows filesystem using the DrvFS
file system with the metadata
option which allows Linux permissions to coexist with Windows files by storing them in file metadata.
sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata
This will allow you to use your SSH Keys across both Operating Systems.
Further reading: https://blogs.msdn.microsoft.com/commandline/2018/01/12/chmod-chown-wsl-improvements/
And yet more reading on how to configure WSL
to apply this setting everytime it starts:
https://blogs.msdn.microsoft.com/commandline/2018/02/07/automatically-configuring-wsl/