10

I've been using WSL to debug C in VSCode, using Ubuntu from the Windows Store.

However, because my school projects must be able to run on a provided Virtual Machine (Lubuntu, in this case), it would be of great help if I could debug my code on Windows, through a connection to the Virtual Machine.

I've failed to find any good tutorials on this, so I tried playing around with the ip addr show command and connecting to the resulting address using ssh, but to no avail.

What would be the best approach to achieve this?

cabralpinto
  • 1,814
  • 3
  • 13
  • 32

1 Answers1

25

Found the solution. In the VM settings, I needed to add a Network Host-only Adapter. From there, I installed openssh-server in my VM:

sudo apt-get install openssh-server openssh-client

Then, by calling ifconfig I got my VM's ip (enp0s8 interface) and connected to it via ssh.

Hopefully this helps anyone facing the same issue.

cabralpinto
  • 1,814
  • 3
  • 13
  • 32
  • In case anyone stumbles upon this: You need to call `ifconfig` *inside* the VM, which gave me the correct IP `192.168.56.101` which I can use as argument to my ssh client. Windows task manager lists the host-only vbox adapter under IP `192.168.56.1`, which is *not* the one you need. – snowflake Oct 30 '21 at 10:32