I am trying to connect my VSCode to a raspberry pi4 via the Remote - SSH extension by Microsoft, but I get a ECONNREFUSED error every time. The error log:
[14:49:20.954] Starting forwarding server. localPort 58139 -> socksPort 58137 -> remotePort 44131
[14:49:20.954] Forwarding server listening on 58139
[14:49:20.954] Waiting for ssh tunnel to be ready
[14:49:20.955] [Forwarding server 58139] Got connection 0
[14:49:20.956] Tunneled 44131 to local port 58139
[14:49:20.957] Resolved "ssh-remote+192.168.42.1" to "127.0.0.1:58139"
[14:49:20.958] Failed to set up socket for dynamic port forward to remote port 44131: connect ECONNREFUSED 127.0.0.1:58137. Is the remote port correct?
[14:49:20.965] ------
[14:49:20.980] [Forwarding server 58139] Got connection 1
[14:49:20.981] Failed to set up socket for dynamic port forward to remote port 44131: connect ECONNREFUSED 127.0.0.1:58137. Is the remote port correct?
VScode will successfully ssh into the pi and install the vscode server, but it fails shortly afterward.
This is the line I fed VSCode to create the SSH host:
ssh -i ~/.ssh/rsa_file [email protected]
The pi's ssh file has:
Port 22
AllowTcpForwarding yes
AllowAgentForwarding yes
AllowStreamLocalForwarding yes
DisableForwarding no
TCPKeepAlive yes
My local config:
Host vscode_to_pi
HostName 192.168.42.1
IdentityFile ~/.ssh/rsa_file
User pi
ForwardAgent yes
ForwardX11 yes
PubKeyAcceptedKeyTypes=+ssh-rsa
HostKeyAlgorithms=+ssh-rsa
StrictHostKeyChecking=no
I have tried:
Some notes:
11.31.76.2v0.101.2023032415I had the same case, and I solved it by deleting the ~/.ssh/known_hosts file on the host that I was attempting to connect from.
My OS: macOS Monterey
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With