Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 613
MarinerZZ Avatar asked Jul 12 '26 00:07

MarinerZZ


2 Answers

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.

like image 136
MarinerZZ Avatar answered Jul 15 '26 05:07

MarinerZZ


If you are using macOS and want to ssh to machine 1.1.1.1:2222 under socks proxy(127.0.0.1:1080), then you can use the below configuration:

Host 1.1.1.1
    HostName 1.1.1.1
        ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p 
    Port 2222
    User YourName

If you are using http proxy or using Windows(Linux), go to check Connect with SSH through a proxy . Then replace the corresponding ProxyCommand.

Hope this could help you.

like image 37
Jianing Avatar answered Jul 15 '26 06:07

Jianing



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!