我最近搬到了一个不同的国家,但我在远程工作,因此我认为我的工作空间不会被打扰。但是,现在我正在尝试通过vscode中的ssh连接到我的工作区,连接一直断开。我通过我的工作空间提供的VPN连接到工作空间,虽然我可以通过ssh连接到我工作的linux机器,但我不能像过去几个月那样通过vscode-remote-ssh扩展连接到它。我的计算机上的设置没有任何更改。我附加了在下面尝试连接时vscode提供的输出(这是重新连接尝试的输出,但第一次连接尝试看起来完全相同)。
[15:36:11.086] ------
[15:36:11.086] SSH Resolver called for "ssh-remote+203.0.113.0", attempt 2, (Reconnection)
[15:36:11.087] SSH Resolver called for host: 203.0.113.0
[15:36:11.087] Setting up SSH remote "203.0.113.0"
[15:36:11.091] Using commit id "e5e9e69aed6e1984f7499b7af85b3d05f9a6883a" and quality "stable" for server
[15:36:11.092] Install and start server if needed
[15:36:11.096] Using SSH config file "C:\Users\windowsUser\.ssh\config"
[15:36:11.096] Running script with connection command: ssh -T -D 53043 -F "C:\Users\windowsUser\.ssh\config" 203.0.113.0 bash
[15:36:11.101] Terminal shell path: C:\Windows\System32\cmd.exe
[15:36:11.240] >
[15:36:11.240] Got some output, clearing connection timeout
[15:36:13.669] > linuxUser@203.0.113.0's password:
[15:36:13.670] Showing password prompt
[15:36:29.329] Got password response
[15:36:29.330] "install" wrote data to terminal: "*******"
[15:36:29.358] >
>
[15:36:31.047] > 3a294560e95d: running
> Acquiring lock on /home/linuxUser/.vscode-server/bin/e5e9e69aed6e1984f7499b7af85b3
> d05f9a6883a/vscode-remote-lock.linuxUser.e5e9e69aed6e1984f7499b7af85b3d05f9a6883a
>
[15:36:31.073] > Found existing installation at /home/linuxUser/.vscode-server/bin/e5e9e69aed6e1984
> f7499b7af85b3d05f9a6883a...
> Found running server...
>
> *
> * Reminder: You may only use this software with Visual Studio family products,
> * as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
> *
>
> Checking server status on port 34103 with wget
>
[15:36:31.108] > 3a294560e95d: start
>
[15:36:31.391] > sshAuthSock====
> listeningOn==34103==
> osReleaseId==ubuntu==
> arch==x86_64==
> webUiAccessToken====
> tmpDir==/run/user/1000==
> platform==linux==
> 3a294560e95d: end
>
[15:36:31.391] Received install output:
sshAuthSock====
listeningOn==34103==
osReleaseId==ubuntu==
arch==x86_64==
webUiAccessToken====
tmpDir==/run/user/1000==
platform==linux==
[15:36:31.392] Remote server is listening on 34103
[15:36:31.392] Parsed server configuration: {"remoteListeningOn":{"port":34103},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","tmpDir":"/run/user/1000","platform":"linux"}
[15:36:31.393] Starting forwarding server. localPort 53048 -> socksPort 53043 -> remotePort 34103
[15:36:31.395] Forwarding server listening on 53048
[15:36:31.395] Waiting for ssh tunnel to be ready
[15:36:31.396] Tunneled 34103 to local port 53048
[15:36:31.396] Resolved "ssh-remote+203.0.113.0" to "127.0.0.1:53048"
[15:36:31.397] [Forwarding server 53048] Got connection 0
[15:36:31.402] ------
[15:36:31.430] [Forwarding server 53048] Got connection 1
[15:36:31.431] [Forwarding server 53048] Got connection 2在断开连接并重复此消息(并再次要求输入密码)之前,连接在[Forwarding server 53048] Got connection 2上挂起了几秒钟。我尝试从linux计算机上删除.vscode-server文件,然后立即重新创建该文件,但它仍然不允许我连接。我还尝试在vscode设置中更改超时,但同样没有效果。我不确定为什么在简单地将计算机从一个地方移动到另一个地方但仍然在同一个vpn上之后会发生这种情况,也不确定为什么我仍然可以使用常规的ssh连接,但不能通过vscode-remote ssh扩展连接。
发布于 2020-11-26 05:54:53
我也有同样的问题,对我来说。我没有解决方案,但有一个糟糕的变通办法--重启远端的机器。我正在运行ubuntu 20.04,一旦我重启,我就可以从visual studio连接,并且连接保持正常,但是一旦我关闭VSC并重启,我又看到了这个问题,我不得不再次重启远端的机器。
编辑:后来我发现用systemctl start/stop sshd停止sshd守护进程也能帮助解决这种情况-所以不需要重新启动
发布于 2021-03-09 15:27:03
您可以手动尝试ssh到服务器并删除远程服务器文件夹,这会使VSCode重新从头开始下载它。
这对我今天很有帮助:
rm -rf ~/.vscode-server/
rm -rf ~/.vscode-remote/该建议来自以下讨论:https://github.com/microsoft/vscode-remote-release/issues/2513
您可能还想检查您的新网络IP是否允许在服务器的目标组中使用。
https://stackoverflow.com/questions/64172004
复制相似问题