VS Code 有个很厉害的插件 Remote-ssh, 实现远程编码和调试,且不依赖对机器的编辑器和调试终端,这个和vs studio不同,后者是需要被控方有对应的终端,要求运行环境两边要一致,非常的方便。远程上后会自动下载环境

71c11a5ad2a7: running
Script executing under PID: 19525
Installing to /Users/lilee/.vscode-server...
71c11a5ad2a7%%1%%
Downloading with curl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   161  100   161    0     0    553      0 --:--:-- --:--:-- --:--:--   555
100 6419k  100 6419k    0     0  6024k      0  0:00:01  0:00:01 --:--:-- 12.7M
Download complete
71c11a5ad2a7%%2%%
tar --version: bsdtar 3.5.3 - libarchive 3.7.4 zlib/1.2.12 liblzma/5.4.3 bz2lib/1.0.8 
code 1.101.1 (commit 18e3a1ec544e6907be1e944a94c496e302073435)
Starting VS Code CLI...
Spawned remote CLI: 19699
Waiting for server log...
71c11a5ad2a7: start
listeningOn==127.0.0.1:63613==
osReleaseId==Darwin==
arch==arm64==
vscodeArch==arm64==
bitness==64==
tmpDir==/tmp==
platform==macOS==
unpackResult==success==
didLocalDownload==0==
downloadTime==1000==
installTime==0==
serverStartTime==0==
execServerToken==740f5f1b-cbc7-486a-ad49-17d35d55730a==
platformDownloadPath==cli-darwin-arm64==
SSH_AUTH_SOCK====
DISPLAY====
71c11a5ad2a7: end

这样带来了一个额外的好处就是,唤醒功能,被控方只有在需要的时候,才起来干活,平时只管休眠就好,也不用在远程机程上安装唤醒组件了。
image-1750458826890

再开一个终端
image-1750458146429

服务端响应:
image-1750458571072

聊天客户端:
image-1750459190074

附:
文中代码