Skip to main content

VSCode + WSL: the SSH way

The initial idea

early 2017, Rich Turner made a demo where Visual Studio was used to develop C++ code, however the debugging environment targeted was WSL!
With some magic, he showed something that he had forbidden from the initial release of WSL: writting directly to the WSL filesystem (still a big no-no actually).

Of course, this triggered a lot of curiosity and the WSL Corsair had to loot from it too!

SSH to save the day

the biggest challenge was to find a way that not only could be easy to setup on both ends, and also would be approved by the WSL team. 
TLDR: if you use the Windows Path, You Die! #ThereBeDragons
Another way, more Linux-oriented, needed to be used and hopefully a solution already existed and was simply waiting on being used: SSH🔐

The setup

the setup is done in 2 distinct parts:
  1. Setup the SSH server on WSL
  2. Setup the SSH client on VSCode 
While the SSH server is a standard procedure in Linux, finding the right plugin for VSCode was a bit more challenging.

Still I’m glad to say that I finally found THE plugin that not only provides SSH support but also provides a more complete “developer environment experience”.


Before we start, there is 2 prerequisites that helped me a lot and I would like to share it:
  1. For the OpenSSH server in your WSL environment, the guides in Internet are legion, but so far the “full solution” that is working all the time for me is the answer of this post: <>
  2. VSCode as an integrated console which is Powershell by default. If you want to avoid going back and forth to the WSL console, you can setup the VSCode console to be your WSL shell.
  3. You can change your user-settings (CTRL+,) with the following line for Ubuntu flavour:
    “”: “C:\\Users\\<Your Username>\\AppData\\Local\\Microsoft\\WindowsApps\\ubuntu.exe”


Once OpenSSH server is configured in WSL, the next step is to configure the VSCode plugin (of course, the help file is to read!):
  1. Install VSCode and/or VSCode-Insiders (this version allows you to use multi root directories in the same workspace)
  2. Install the plugin “FTP-Simple”
  3. Open the command bar (CTRL+SHIFT+P) and search for ftp-simple: config
  4. Create a first basic configuration just to ensure everything is working fine
  5. Open the command bar (CTRL+SHIFT+P) and search for ftp-simple: Remote directory to Workspace
  6. Choose your connection according to the name you provided in step 4
  7. [Optional] If you didn’t insert the password, type the password to the WSL account
  8. Choose from where the initial path should be open
  9. The workspace should be now open with the files and directories from the path you provided in step 4

Finally, let's play

Now that everything is installed and configured, open a WSL terminal (in or out of VSCode depending on your setup), do some changes in your files from VSCode and see the changes being applied to your WSL files.

Last (random) comments

  • This solution does not work with a separated terminal opened. The Workspace of VSCode keeps the SFTP connection alive, that’s what allow us to directly modify the files without having a new VSCode window being open
  • Your initial directory is the new ‘/’. You can think of it as a ‘chroot’. This means that if you try to open a file that is ‘below’ your initial directory, it will not work
  • Microsoft is working hard on bringing full interopability between WSL and Windows applications (filesystem included). So consider this post to be obsolete in the (near?) future.
  • The SSH solution is not my idea and it’s just an adaptation of Microsoft own solution for C++ and WSL <>.
Happy coding in your brand new WSL-VSCode environment.

>>> Nunix Out <<<


Popular posts from this blog

WSL: One Home to host them all

IntroductionThis blog post will explain how a single home mount can be shared accross all the WSL instances. It was quite fun to find the idea and then make it happen. It will use all the tools currently available from WSL, so please don't expect a "Linux only" as Interopability will be heavily used. And before I start, here is my point of view about WSL: It's not only Linux!
It's different, just like GNU is different from Unix (yes I said it).We have finally the strength of both worlds combined. And while I do understand the "dev" aspect is meant to be reproducible in a Linux prod environment, the "ops" side is meant to take advantages of everything that can make the full environment feeling Home. Setup requirementsIn order to really enjoy this solution, I do recommend having 2 or more WSL distros installed or, if you fell like a real WSLCorsair, try @bketelsencrazy setup (I love it)!
While the distros are downloading, let's prepare the Windo…

Scripting with GO: what about Windows?

!!! Warning !!!Once again, let me repeat, I'm by no means a developer nor a sysadmin (at least no more since 5 years).
This means that, while the solution below worked for me and I could reproduce it, it's not 100% safe neither!
Also, my solution still feels incomplete (read further), so if someone know the tweak to make it even more compete, please share it and reach out in Twitter, I'll be waiting.
IntroductionBy now, everyone following @jessfraz read her take about the very neat "little hack" from @cloudflareUsing Go as a scripting language in Linux

As a good WSL Corsair, I tried it and it just worked!
But then, based on my latest playground of having a seamless coding experience between WSL and Windows (thanks @bketelsen for the love and notification spam), I really thought it would be unfair to "my Windows side" to not be able enjoying the fun of GO scripting (yes, split personality is bad).

So as the good Corsair I am, it was time to see if some shinn…

Docker + WSL: Get 2 daemon for the price of 1

Introductionalmost two years ago, Docker announced the capability of switching between the Linux and Windows containers "mode" (far from the right click that we have today).
At that time, I wrote a blog post on how to run both daemons at the same time (

Fast forward to 2018, and while we were blogging on how to get the TLS connection from WSL docker client with Rory McCune (, another blog post, by Stefan Stranger drew my attention (read: blew my mind) as I was trying to reproduce the same: how could I "bind" the docker socket in WSL with the Docker for Windows Linux mode socket (
From 1 to 2 daemon: DemonHunter mode achievedNow that we have all the required setup resources, let's bind them together. An…