Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
709 views
in Technique[技术] by (71.8m points)

visual studio code - Using "Remote SSH" in VSCode on a target machine that only allows inbound SSH connections

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...