Zit Seng's Blog

A Singaporean's technology and lifestyle blog

Using WSL for Remote-SSH in VS Code

I’ve been a vi user for decades, but perhaps about half a year ago, started to dabble a bit with Microsoft’s Visual Studio (VS) Code. It’s a nice editor and development environment, but there’s a bit of inelegance in working with remote development on SSH servers.

I use WSL a lot locally, and I SSH a lot from inside WSL. VS Code has nice built-in remote SSH development support, but it wants to use the Microsoft supplied OpenSSH in Windows 10. The problem with Microsoft’s OpenSSH is two-fold:

  • It keeps its own set of configuration and keys in %USERPROFILE%\.ssh\. This is kind of inconvenient when you use SSH inside WSL a lot. I know I could sync the two environments, but it’s just inelegant I just want one copy of my SSH setup.
  • A bigger problem is that Microsoft’s OpenSSH doesn’t provide support for ProxyJump, a feature I use a lot. This is a convenient feature for tunnelling connections through jump hosts. Again, there are workarounds using ProxyCommand, but I find them inelegant.

What I really want is for VS Code to simply call the ssh program inside WSL. This seems to be an oft requested feature. I hope Microsoft gets around to working this out eventually, with out-of-the-box support for WSL’s ssh. This has annoyed me enough to finally get me looking for a solution.

The issue here is to get VS Code to call a different SSH. We can’t seem to call wsl.exe ssh directly, but it seems to work if we give VS Code a batch file to call.

So here’s what to do. First, make sure that the “Remote – SSH” extension has been installed. Next, create a simple batch file ssh.bat inside, say, C:\Users\<username>\bin and put this single line in it:

C:\Windows\system32\wsl.exe ssh %*

Then, in VS Code settings, set remote.ssh.path to:


That’s it. Now you’ll have the same SSH configuration and credentials in VS Code as you have in WSL.

3 thoughts on “Using WSL for Remote-SSH in VS Code

  1. This worked nicely for me!!! Thank you very much.

    I just only had to enable also the ssh agent in the wsl Ubuntu OS, because I am using a passphrase protected key for ssh authentication.

Leave a Reply to Felipe Portella Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

View Comment Policy