1、检查ssh配置
sudonanoetc/ssh/sshd_config确保配置
# 登录与认证PermitRootLogin no# 推荐 no(VS Code 不需要 root)PasswordAuthenticationyes# yes(密码登陆)PubkeyAuthenticationyes# 推荐同时开启(公钥登陆)KbdInteractiveAuthenticationyesUsePAMyes# 连接稳定性ClientAliveInterval30ClientAliveCountMax3TCPKeepAliveyes# VS Code / scp / sftp 必需AllowAgentForwardingyesAllowTcpForwardingyesPermitTTYyes2、检查vscode配置
设置->扩展->Remote-SSH->在json中编辑
"remote.SSH.configFile":"~/.ssh/config",配置路径"remote.SSH.connectTimeout":30,超时时间"remote.SSH.path":"/usr/bin/ssh",ssh路径"remote.SSH.localServerDownload":"always"确保vscode会远端下载失败就走本地 +scp3、检查网络
确保远端shell没有被污染
sshuser@xxx.xxx.xxx.xx"echo OK"# 应该输出OK连不上大概率是因为不能从vscode下载code server,Remote SSH插件会做这些事
1、ssh 登录(密码或密钥)2、在远端执行:mkdir~/.vscode-server3、 检测远端 OS / 架构4、从微软服务器下载: vscode-server-linux-{arch}.tar.gz5、在远端解压如果失败则在你的电脑下载然后scp到远程解压6、启动 node + server7、本地 VS Code 通过 SSH 隧道连接 server如果vscode显示正在本地下载 VS Code 服务器然后失败,说明本地电脑也无法下载,开启本地电脑全局代理即可