Add certificate into WSL

December 29, 2020

I’ve recently been playing with WSL2, and one of the things that quickly bites you, is trying to move between your Linux distribution, and the main Windows system. In this particular instance, I had a certificate that I needed to apply to the WSL system.

The process turns out to be as follows

Copy cert to ```

/usr/local/share/ca-certificates


For example, say your certificate was here:


c:\tmp\mycert.cer




You can copy this inside the WSL:


cp /mnt/c/tmp/mycert.cer /usr/local/share/ca-certificates




Once you've copied it here, run the update-ca-certificates command:


sudo update-ca-certificates




If it works, your certificate will be here:


/etc/ssl/certs




# Notes

This was done on an Ubuntu distribution, but I'm not aware it would change based on that.

# References

[https://github.com/microsoft/WSL/issues/3161](https://github.com/microsoft/WSL/issues/3161)


Profile picture

A blog about one man's journey through code… and some pictures of the Peak District
Twitter

© Paul Michaels 2024