Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode Remote SSH Connection Failed

I'm trying to use the Remote-SSH extension to edit files on a Debian server. The SSH connection is established correctly but then I get an error message :

Failed to connect to the remote extension host server

And the log :

[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

I am using the remote ssh connection on several other servers and have never had this error. I have tested a few things gleaned from the web but nothing has worked so far.

Could someone enlighten me on the reason for the problem or on a possible solution ? Thanks !

like image 502
Padd Avatar asked Mar 03 '20 12:03

Padd


People also ask

What happened to the remote/remote SSH extension in VSCode?

After VSCode update 1.37.0 the Remote/Remote SSH extension (s) cannot connect to the remote server anymore as was working before. As seen on two different machines both using windows host with vs code to connect to a VM running Ubuntu 18.04.

How to fix remote-SSH not working in VS Code?

Remote-SSH: kill VS Code Server on Host... And after this procedure, try connecting again to the host. That worked for me. In my case it was ssh plugin issue. I updated remote ssh plugin then it worked wrong proxy setting may cause problem.

Can I use VS Code on a remote SSH server?

Consult the extension's documentation for details if you run into trouble. All other communication between the server and the VS Code client is accomplished through the authenticated, secure SSH tunnel. Can I use local tools on source code sitting on the remote SSH host? # Yes.

How do I use SSH in Visual Studio Code?

Remote Development using SSH The Visual Studio Code Remote - SSH extension allows you to open a remote folder on any remote machine, virtual machine, or container with a running SSH server and take full advantage of VS Code's feature set. Once connected to a server, you can interact with files and folders anywhere on the remote filesystem.


2 Answers

Changing AllowTcpForwarding from no to yes in sshd_config and restarting sshd works for me.

Tested on Raspbian GNU/Linux 10 (buster)

like image 79
pek Avatar answered Sep 28 '22 08:09

pek


Delete '~/.vscode-server' folder on your server, and try reconnect.

Not sure for Debian server, but this worked on Ubuntu 18.04

like image 32
jns Avatar answered Sep 28 '22 08:09

jns