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.
13
votes
3 Answers
20
votes
After several days struggling, I have figure it out. As Marc said, vscode respects the tunnels I setup in my .ssh/config file. A sample can be like :
Host server1
HostName server1_ip
PreferredAuthentications publickey
IdentityFile your_key
User you
Host server2
Hostname server2_ip
IdentityFile your_key
ProxyJump server1
User you
2
votes
0
votes
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