Search code examples
sshvisual-studio-coderemote-accessvscode-remote

Is it possible to create a proxy in Remote-SSH Visual Studio Code?


I need to connect via REMOTE-SSH in Visual Studio Code to a machine with ssh but from a specific machine in which I have previously connected through ssh to.

I can connect to the first machine with no problem, the problem is when I am logged in the first machine and I try to connect to the second it doesn't let me. I have been looking but what I can only find is examples showing how to connect only to one machine without passing through an other one.


Solution

  • Thanks to a partner, I have found a solution and it consists in changing a little bit the config file from ssh

    As I am using VS Code in Windows and I wanted not to use netcat I've implemented the next command to create a proxy:

    Host <target-machine-name>
    HostName <target-machine-ip>
    User <user>
    ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -q -x <proxy-machine-name> -W %h:22
    

    Hope it can help someone else with the same issue.