SSH remote connection fails on Windows — hardcoded /usr/bin/ssh path
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using Claude Code Desktop on Windows and attempting to connect to a remote machine via SSH, it fails with:
Failed to spawn /usr/bin/ssh: spawn /usr/bin/ssh ENOENT
The SSH spawning logic appears to hardcode the Unix path /usr/bin/ssh, which doesn't exist on Windows. On Windows, SSH is typically located at C:\Windows\System32\OpenSSH\ssh.exe or C:\Program Files\Git\usr\bin\ssh.exe.
Expected behavior: Claude Code should detect the platform and resolve the SSH binary path accordingly (e.g., using where ssh on Windows or respecting the system PATH).
Environment:
- Windows 11 Pro
- Claude Code Desktop (latest)
- OpenSSH 10.2p1 installed and working from terminal
What Should Happen?
Claude Code should detect the operating system platform and resolve the SSH binary path accordingly. On Windows, it should:
- Use the appropriate SSH executable locations (e.g., C:\Windows\System32\OpenSSH\ssh.exe or C:\Program Files\Git\usr\bin\ssh.exe)
- Respect the system PATH environment variable to locate ssh
- Use platform detection to determine the correct binary path instead of hardcoding /usr/bin/ssh
This would allow remote SSH connections to work properly on Windows systems with OpenSSH installed.
Error Messages/Logs
Steps to Reproduce
- Open Claude Code Desktop on Windows 11
- Navigate to the SSH feature/settings
- Attempt to configure a remote SSH connection to any machine
- Try to connect using the SSH remote feature
Expected result: Connection should attempt to establish
Actual result: Connection fails with error "Failed to spawn /usr/bin/ssh: spawn /usr/bin/ssh ENOENT"
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
latest
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
11 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Same problem here, thank you.
Та же проблема
I'm experiencing the same problem.
Same problem
same problem
I've tried these commands as a workaround but got another error:
Host denied (verification failed)Following advice from @SSS135 in this thread, I created a symlink to work around it:
This fixed the ENOENT error — but revealed a second, separate bug: the app now uses its built-in ssh2 library (as seen by
[SSH2Connection]in logs instead of spawning system ssh), and host key verification is completely broken for non-standard SSH ports.Environment
The new error
After the symlink workaround, every connection attempt now fails with:
The host key IS in
~/.ssh/known_hosts. The same SSH connection works perfectly from any terminal:ssh -p 40010 root@<host>connects instantly.What I tried to fix it (nothing works)
| Attempt | Result |
|---------|--------|
| Host key in
known_hostsas[<host>]:40010(standard OpenSSH format) | Not recognized by Claude Desktop || Host key added as
<host>(without port, without brackets) | Not recognized || Host key added as
<host>:40010(colon format matching the log output) | Not recognized ||
trustedHostsinssh_configs.jsonwith all format variants | No effect whatsoever ||
StrictHostKeyChecking noin~/.ssh/configfor this host | Ignored ||
UserKnownHostsFile /dev/nullin~/.ssh/config| Ignored || Full restart of Claude Desktop between each attempt | Same error |
Verified via
ssh-keygen -F "[<host>]:40010"that the keys are present and valid (ed25519, rsa, ecdsa — all three).Additional bug:
~not resolved insshIdentityFileon WindowsThe
sshIdentityFilefield inssh_configs.jsondoes not resolve~on Windows."sshIdentityFile": "~/.ssh/id_ed25519"→ log showskey: false(key not found)"sshIdentityFile": "C:\\Users\\<user>\\.ssh\\id_ed25519"→ log showskey: true(works)ssh.log timeline showing both bugs in sequence
Phase 1 — ENOENT (before symlink workaround):
Phase 2 — Host verification failure (after symlink, ssh2 library used):
Root cause analysis
The built-in ssh2 library in Claude Desktop:
known_hostsfor non-standard ports. OpenSSH stores non-standard port entries as[host]:port(with square brackets). The ssh2 library searches forhost:port(without brackets) and never finds a match.trustedHostsinssh_configs.json. This field appears to have no effect on host key verification.StrictHostKeyCheckingandUserKnownHostsFilefrom~/.ssh/config. The ssh2 library readsHost,Port,HostNamefrom the config (it resolves the port correctly), but does not respect security-related directives.Suggested fixes
known_hostsparsing to handle the[host]:portbracket format per OpenSSH spectrustedHostsinssh_configs.jsonactually bypass host verificationStrictHostKeyCheckingfrom~/.ssh/config~insshIdentityFileon WindowsWorkaround
None for Claude Desktop with non-standard SSH ports on Windows. Claude Code CLI works fine since it uses system OpenSSH.
---
This effectively means SSH remote connections on Claude Desktop are broken for anyone using non-standard ports
Thank you @pockerhead for the additional detail. I run sshd on other ports for many of my sandbox VMs. The suggested fixes would be amazing.
IMO, a roadmap to your suggestion should be that Claude runs the built in Windows ssh (C:\Windows\System32\OpenSSH\ssh.exe) and expects that the user has already set up the and established a connection that succeeds that way. Then it could leverage what you get out of a git (cygwin) bash+ssh solution. But it has to build off of the "potentially duplicated issues" cited above by running bash via those git installs and then running ssh within those shells. Lastly, wsl is installed andthe user has a home dir with .sssh/XXXs stuff, use that to execute the ssh connections,
Sorry about this folks, this will be fixed in the next release.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.