Cannot use vs code remote ssh with cygwin over http proxy on windows 11

73 views Asked by At

I am trying to connect to a remote vm using ssh. Due to my company network settings the only way to achieve this is using an http proxy in the port 443.

I can successfully log into the vm (the vm has a custom port for ssh) using cygwing and corkscrew tool with the following command:

ssh -i KEYNAME.pem -o 'ProxyCommand corkscrew X.X.X.X 443 %h %p' -p PORT [email protected]

However, when I try to use remote ssh in vscode to access the files and edit the code I got an error Could not establish connection to VMname

Digging into the logs I discovered that the root of the problem is caused by this log:

[12:03:40.210] Checking ssh with "C:\\cygwin64\\bin\\ssh.exe -V"
[12:03:45.756] > OpenSSH_9.5p1, OpenSSL 3.0.12 24 Oct 2023

[12:03:45.764] Using SSH config file "C:\cygwin64\home\USERNAME\.ssh\config"
[12:03:45.765] Running script with connection command: "C:\\cygwin64\\bin\\ssh.exe" -T -D 59221 -F "C:\cygwin64\home\USERNAME\.ssh\config" "dev-vm" bash
[12:03:45.769] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[12:03:50.411] > /bin/sh: line 1: exec: corkscrew: not found

My config file looks like this:

Host dev-vm
    HostName X.X.X.X
    User username
    IdentityFile keyname.pem
    Port portnumber
    ProxyCommand corkscrew X.X.X.X 443 %h %p

As you can see, vs code is taking the Terminal shell path: C:\WINDOWS\System32\cmd.exe where the corkscrew tool does not exists and causing the /bin/sh: line 1: exec: corkscrew: not found error. The correct path should be C:\\cygwin64\\bin\\bash.exe where the tool is installed.

I have already configured the settings.json file with the following options:

"terminal.integrated.profiles.windows": {
        "Cygwin": {
          "path": "C:\\cygwin64\\bin\\bash.exe",
          "args": ["--login"],
          "env": {"CHERE_INVOKING": "1"}
        }
      },
      "remote.SSH.path": "C:\\\\cygwin64\\\\bin\\\\ssh.exe",
      "remote.SSH.configFile": "C:\\cygwin64\\home\\USERNAME\\.ssh\\config",
      "terminal.integrated.defaultProfile.windows": "Cygwin",

Thank you in advance.

0

There are 0 answers