I have a gpu-server Server-A in office. The only way to access that server is through the office wired network. The office provides a proxy server Server-B. How I connect to the Server-A? I first ssh login Server-B, then in the bash of Server-B, ssh login Server-A. I want to use vscode remote extension to work for Server-A. How can I do? I can connect to Server-B now in vscode.
-
I also need double ssh-- first ssh jumper machine, then from jumper machine ssh to dev machine,hope vs code support double ssh – leafonsword Sep 23 '19 at 07:15
4 Answers
After several days of struggling, I figured it out. As Marc said, vscode respects the tunnels I setup in my .ssh/config file. A sample can be like this:
Host serverB
HostName serverB_ip
PreferredAuthentications publickey
IdentityFile your_key
User you
Host serverA
Hostname serverA_ip
IdentityFile your_key
ProxyJump serverB
User you

- 1,113
- 1
- 11
- 19
-
7So 1=B and 2=A? Would be easier to snatch your solution if you used the names in the question! – Jonatan Öström Dec 28 '21 at 22:23
Have you looked into setting up a tunnel in your ssh config to go to Server-A via Server-B?I believe vscode will respect the tunnels you setup in your .ssh/config file.

- 119
- 4
Yes, its very easy:
You can install in VSCODE the sftp plugin and set the config file (.vscode\sftp.json) like this:
{
"name": "CONEXION 1",
"remotePath": "/",
"host": "192.168.1.98",
"username": "user",
"privateKeyPath": "C:/Users/Usuario/.ssh/id_rsa",
"passphrase": true,
"uploadOnSave": true,
"hop": {
"host": "11.0.0.255",
"port": 22,
"username": "user",
"password": "password"
}
After that, you can see in sftp:explorer the "CONEXION 1" to deploy it. Right button "edit file" to change it in file explorer.
You have many options to do things very powerfull (more steps hops for example...).
Plugin: https://marketplace.visualstudio.com/items?itemName=liximomo.sftp

- 11
- 1
it is very easy now with VS code Remote-SSH by using Jump host option
ssh -J server_gate_way_proxy destination_server
ssh -tt server_gate_way_proxy ssh -tt destination_server

- 1
- 2