Using "Remote SSH" in VSCode on a target machine that only allows inbound SSH connections

30,340

Solution 1

When you connect to a host it executes a bash script that wgets or curls a tarball and extracts it in a directory in your home directory. Here's an offline workaround.

  1. Attempt to connect, let it fail

  2. On server, get the commit id

    $ ls ~/.vscode-server/bin
    553cfb2c2205db5f15f3ee8395bbd5cf066d357d
    
  3. Download tarball replacing $COMMIT_ID with the the commit number from the previous step

For Stable Version

https://update.code.visualstudio.com/commit:$COMMIT_ID/server-linux-x64/stable

For Insider Version

https://update.code.visualstudio.com/commit:$COMMIT_ID/server-linux-x64/insider

  1. Move tarball to ~/.vscode-server/bin/$COMMIT_ID/vscode-server-linux-x64.tar.gz

  2. Extract tarball in this directory

    $ cd ~/.vscode-server/bin/$COMMIT_ID
    $ tar -xvzf vscode-server-linux-x64.tar.gz --strip-components 1
    
  3. Connect again

You'll still need to install any extensions manually. There's a download button next to all the extensions in the marketplace. Once you have the .vsix file you can install them through the GUI with the Install from VSIX option in the extensions manager.

This is kind of a pain and hopefully they improve this process, but if you have a network-based home directory, you only have to do this once.

Solution 2

open vscode -> about

Version: 1.46.1

Commit: cd9ea6488829f560dc949a8b2fb789f3cdc05f5d

Date: 2020-06-17T21:17:14.222Z

Electron: 7.3.1

Chrome: 78.0.3904.130

Node.js: 12.8.1

V8: 7.8.279.23-electron.0

OS: Darwin x64 17.7.0

$COMMIT_ID = cd9ea6488829f560dc949a8b2fb789f3cdc05f5d

Solution 3

A new feature is being added to support offline install

However, you can now solve this issue by a new user setting in the Remote - SSH extension. If you enable the setting remote.SSH.allowLocalServerDownload, the extension will install the VS Code Server on the client first and then copy it over to the server via SCP.

Note: This is currently an experimental feature but will be turned on by default in the next release

https://code.visualstudio.com/blogs/2019/10/03/remote-ssh-tips-and-tricks

Share:
30,340
Fakhamatia
Author by

Fakhamatia

Updated on September 06, 2020

Comments

  • Fakhamatia
    Fakhamatia over 3 years

    Is there a way to use the VSCode Remote SSH extension to interact with a remote host that does not allow outbound internet connections?

    Is it possible to download the vscode-server files from another system and copy to host?

    I read this but I can't connect the server to internet.