Skip to content

Instantly share code, notes, and snippets.

@isogram
Created August 26, 2021 05:21
Show Gist options
  • Save isogram/90cb06a2be35642df911d66a47173ae8 to your computer and use it in GitHub Desktop.
Save isogram/90cb06a2be35642df911d66a47173ae8 to your computer and use it in GitHub Desktop.
Fix remote ssh visual code studio cannot connect server host

Failed to set up socket for dynamic port forward to remote port 40413: Socket closed. Is the remote port correct?

Follow these steps

  • Update the sshd_config file in the host machine. Follow this command: nano /etc/ssh/sshd_config and then set AllowTcpForwarding to yes
  • Restart ssh on the host machine sudo systemctl restart ssh
  • Delete the .vscode-server in host machine rm -rf /home/<user_name>/.vscode-server

Now connect through VS Code again. Hopefully it will work

source: https://stackoverflow.com/a/68815636/2212582

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment