Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VSCode远程SSH连接失败_Ssh_Visual Studio Code_Remote Debugging_Vscode Remote - Fatal编程技术网

VSCode远程SSH连接失败

VSCode远程SSH连接失败,ssh,visual-studio-code,remote-debugging,vscode-remote,Ssh,Visual Studio Code,Remote Debugging,Vscode Remote,我正在尝试使用远程SSH扩展来编辑Debian服务器上的文件。SSH连接已正确建立,但随后我收到一条错误消息: Failed to connect to the remote extension host server 和日志: [13:19:04.182] Remote server is listening on port 51569 [13:19:04.182] Parsed server configuration: {"agentPort":51569,"osReleaseId":"

我正在尝试使用远程SSH扩展来编辑Debian服务器上的文件。SSH连接已正确建立,但随后我收到一条错误消息:

Failed to connect to the remote extension host server
和日志:

[13:19:04.182] Remote server is listening on port 51569
[13:19:04.182] Parsed server configuration: {"agentPort":51569,"osReleaseId":"debian","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","tmpDir":"/tmp"}
[13:19:04.184] Starting forwarding server. localPort 59828 -> socksPort 59825 -> remotePort 51569
[13:19:04.185] Forwarding server listening on 59828
[13:19:04.185] Waiting for ssh tunnel to be ready
[13:19:04.186] Tunneled remote port 51569 to local port 59828
[13:19:04.186] Resolved "ssh-remote+home-debian.web-data.host" to "127.0.0.1:59828"
[13:19:04.187] [Forwarding server 59828] Got connection 0
[13:19:04.195] ------
[13:19:04.208] [Forwarding server 59828] Got connection 1
[13:19:04.208] [Forwarding server 59828] Got connection 2
[13:19:04.217] Failed to set up socket for dynamic port forward to remote port 51569: Socket closed. Is the remote port correct?
[13:19:04.227] > channel 3: open failed: administratively prohibited: open failed
[13:19:04.235] Failed to set up socket for dynamic port forward to remote port 51569: Socket closed. Is the remote port correct?
[13:19:04.237] Failed to set up socket for dynamic port forward to remote port 51569: Socket closed. Is the remote port correct?
[13:19:04.241] > channel 4: open failed: administratively prohibited: open failed
> channel 5: open failed: administratively prohibited: open failed
我在其他几个服务器上使用远程ssh连接,从未出现过此错误。我已经测试了从网上收集的一些东西,但到目前为止没有任何效果

有人能告诉我这个问题的原因或可能的解决办法吗?谢谢

[13:19:04.227] > channel 3: open failed: administratively prohibited: open failed
您连接到的远程服务器拒绝为您执行端口转发。假设远程服务器是OpenSSH,则远程服务器上有两个地方可以配置它:

  • 服务器可能被配置为不允许通过一个或多个选项进行端口转发
  • 如果使用ssh密钥进行身份验证,则可能会通过选项或禁用转发

  • 对于Debian服务器不确定,但这在Ubuntu 18.04上有效,在sshd\u配置中将
    allowtcpfrowarding
    no
    更改为
    yes
    ,重新启动
    sshd
    对我来说很有效


    在拉斯宾GNU/Linux 10(buster)上测试;我遇到了同样的问题,重新启动似乎可以解决问题。

    谢谢您的帮助!我认为这是因为我没有使用root用户连接到ssh服务器。问题可能是这样的吗?与其提供一个推测性的答案,不如提供一个您已经测试过并且知道是有效的(在Debian上),或者可能已经被其他人确认过的答案。谢谢--我至少有两次使用VSCode的远程SSH完全不可用,或者工作不正确,这就解决了问题。我不能说它为什么起作用,我想更好地理解它。在后一种“工作不正确”的情况下,它似乎没有运行我的~/.profile,在删除了我不再需要的~/.bash_配置文件后,新的远程会话没有拾取~/.profile,但在杀死远程vscode服务器并删除~/.vscode服务器文件夹后,它回来了,现在可以正常工作了。不确定为什么,但这在Ubuntu18.04上有效。在Debian9上测试时,在/etc/ssh/sshd_配置中有一个部分:AllowAttorwarding no,但我只将AllowTcpForwarding no改为yes,它可以工作!非常感谢你!我同意。在我的情况下,连接在编码会话的中间中断,然后尝试重新启动VSCODE,导致远程连接挂起,或者导致成功的连接,但未能同步工作区。服务器端守护进程也可以挂起,ssh配置只是其中的一部分。重新启动远程主机确实可以解决某些问题。
    Delete '~/.vscode-server' folder on your server, and try reconnect.