使用“远程 SSH"在只允许入站 SSH 连接的目标机器上的 VSCode 中 [英] Using "Remote SSH" in VSCode on a target machine that only allows inbound SSH connections

查看:23
本文介绍了使用“远程 SSH"在只允许入站 SSH 连接的目标机器上的 VSCode 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用 VSCode 远程 SSH 扩展与不允许出站互联网连接的远程主机交互?

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

是否可以从另一个系统下载 vscode-server 文件并复制到主机?

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.

推荐答案

当您连接到主机时,它会执行一个 bash 脚本,该脚本 wgets 或 curl 一个 tarball 并将其解压缩到您的主目录中的一个目录中.这是一种离线解决方法.

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. 尝试连接,失败

  1. Attempt to connect, let it fail

在服务器上,获取提交 ID

On server, get the commit id

$ ls ~/.vscode-server/bin
553cfb2c2205db5f15f3ee8395bbd5cf066d357d

  • 下载 tarball,将 $COMMIT_ID 替换为上一步中的提交号

  • Download tarball replacing $COMMIT_ID with the the commit number from the previous step

    稳定版

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

    内幕版

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

    1. 将 tarball 移动到 ~/.vscode-server/bin/$COMMIT_ID/vscode-server-linux-x64.tar.gz

    在这个目录中解压 tarball

    Extract tarball in this directory

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

  • 重新连接

  • Connect again

    您仍然需要手动安装任何扩展程序.市场上所有扩展程序旁边都有一个下载按钮.获得 .vsix 文件后,您可以使用扩展管理器中的从 VSIX 安装选项通过 GUI 安装它们.

    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.

    这篇关于使用“远程 SSH"在只允许入站 SSH 连接的目标机器上的 VSCode 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆