Diagnosing VS Code Remote - SSH Connection Failures
A diagnostic guide for when VS Code cannot open or keep a Remote - SSH connection, with ordered checks, fixes, and escalation criteria.
24 Jul 2025, 20:49 UTC

The problem: VS Code cannot open or keep a Remote - SSH connection
You select a remote host in the Remote - SSH extension and the window either hangs, shows “Failed to connect to host,” or drops the connection shortly after the SSH handshake. The useful takeaway is that most failures fall into two groups: local authentication problems before the shell starts, and remote server problems after the shell starts but before VS Code attaches.
Recognizable conditions
- The host picker opens, but choosing a host produces no new window after several seconds.
- A notification reads “Failed to connect to host” or “Cannot connect to the remote machine.”
- VS Code opens a remote window, then disconnects with “Connection lost” while you are editing.
- The status bar stays on “Connecting to [host]” indefinitely.
Common causes and first checks
| Condition | Likely cause | First check |
|---|---|---|
Manual ssh works outside VS Code but VS Code fails | SSH key missing, wrong permissions, or wrong port in config | Run ssh <host> from a terminal |
| VS Code hangs after host selection | Host-key verification prompt or missing identity file | Open Output panel > Remote SSH log |
| Connection drops right after attaching | VS Code Server cannot start due to missing glibc or libstdc++ | Inspect ~/.vscode-server on the remote host |
| Works in Stable but not Insiders, or vice versa | Mixed server versions in the same ~/.vscode-server/bin path | Compare VS Code release channel and server folder date |
Ordered checks
-
Check 1: Confirm SSH works outside VS Code
Open the VS Code integrated terminal (Terminal > New Terminal) or your system terminal and run:
ssh -vvv <host>Replace
<host>with the alias from your SSH config. You need read permission on the private key referenced by that config. A successful check ends at a remote shell prompt without asking for a password or confirming an unknown host key. If the command hangs or fails, fix SSH itself before troubleshooting VS Code.Risk:
-vvvmay print key fingerprints and host names. Do not share that output publicly. -
Check 2: Read the Remote SSH log
In VS Code, open the Output panel (View > Output), select “Remote SSH” from the dropdown, and reproduce the connection attempt. Look for:
- “reading SSH config file” followed by the host entry
- “installing VS Code Server” or “downloading server”
- an attach message such as “Acquiring lock” or “Extension host started”
- error lines mentioning “Permission denied,” “Host key verification failed,” or “glibc”
If the log stops at authentication, the issue is local SSH configuration. If it reaches server installation and then stops, the issue is likely on the remote host.
-
Check 3: Inspect the remote VS Code Server directory
From a working remote shell, run:
ls -la ~/.vscode-server/binThen try the newest folder’s node binary:
~/.vscode-server/bin/<server-folder>/bin/node --versionReplace
<server-folder>with the actual dated folder name. If the directory is empty, the server was never installed. Ifnodefails with a “version `GLIBC_...` not found” error, the remote C library is older than the server requires. -
Check 4: Confirm remote OS and library versions
Run on the remote host:
ldd --versionCompare the glibc version line against the VS Code release notes for your client version. VS Code Server binaries are built against specific glibc ranges; older enterprise Linux distributions often need a newer VS Code release or a remote environment with updated libraries.
Fixes tied to findings
Fix A: Correct SSH identity and host settings
If Check 1 fails, edit your local SSH config (typically ~/.ssh/config on Linux and macOS, %USERPROFILE%\\.ssh\\config on Windows). Back up the file first. Add or correct:
Host example
HostName 203.0.113.10
User deploy
Port 2222
IdentitiesOnly yes
IdentityFile ~/.ssh/id_ed25519_example
Set the private key permissions so only your account can read it (for example, chmod 600 ~/.ssh/id_ed25519_example on Linux or macOS). Copy the matching public key to ~/.ssh/authorized_keys on the remote host. Do not paste private keys into issue trackers.
Fix B: Install missing remote dependencies or change VS Code release
If Check 3 or 4 shows a glibc or libstdc++ error, install the missing packages on the remote host if you have administrative access, or use a VS Code release whose bundled server supports the remote glibc version. VS Code Server versions are tied to the VS Code release; do not mix Stable and Insiders clients against the same ~/.vscode-server path without testing, because incompatible server binaries can cause repeated disconnects.
Fix C: Clear a stale server installation
If the server folder exists but attach fails repeatedly, rename the folder so VS Code downloads a fresh copy:
mv ~/.vscode-server/bin/<server-folder> ~/.vscode-server/bin/<server-folder>.bak
This changes remote state. Reconnecting triggers a fresh download. Keep the backup until you confirm the new server works, then remove it.
Escalation criteria
Escalate to a VS Code issue tracker when:
- Manual
ssh <host>works without a password, but VS Code still cannot attach. - The Remote SSH log shows a crash or internal error unrelated to authentication or glibc.
- The problem reproduces across multiple remote hosts with different operating systems.
Include the host OS, OpenSSH version, VS Code version and release channel (Stable or Insiders), and the relevant Remote SSH log excerpts. Remove private keys, passwords, and host names before sharing.
Limitations and practical verification
This guide covers well-established SSH and VS Code Server behavior. It does not cover corporate proxy authentication, two-factor SSH flows, or container-based remote development. Verify the result by opening a folder on the remote host, creating a file, and confirming the file appears after reconnecting. If the window stays connected for at least five minutes of idle time and the Output panel shows an attach message, the connection is functioning.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.