'Does vscode remote support double ssh?
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-B? 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.
Solution 1:[1]
After several days of struggling, I have figured it out. As Marc said, vscode respects the tunnels I setup in my .ssh/config file. A sample can be like this:
Host serverA
HostName serverA_ip
PreferredAuthentications publickey
IdentityFile your_key
User you
Host serverB
Hostname serverB_ip
IdentityFile your_key
ProxyJump serverA
User you
Solution 2:[2]
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.
Solution 3:[3]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Marc Brooks |
Solution 3 | Fernando Cano Duque |