Skip to content

Claude Desktop SSH: "Timed out while waiting for handshake" - testSSHConnection succeeds but getSSHGitInfo always fails #32734

Description

@Keninvestment

Environment

  • MacBook Air (client): macOS, Claude Desktop CCD v2.1.64
  • Mac mini (server): macOS, Claude Code v2.1.72 (CLI)
  • SSH: OpenSSH, Remote Login enabled, ed25519 + RSA keys configured
  • Network: Local network (mDNS: KennoMac-mini.local)

Problem

Claude Desktop's SSH remote connection feature consistently fails with "Timed out while waiting for handshake" error.

Terminal SSH works perfectly: ssh kensmba@KennoMac-mini.local connects instantly and claude runs fine remotely.

What was tried (all failed)

  1. Updated Claude Code to latest on both machines
  2. Changed KEX algorithms — Modified /etc/ssh/sshd_config.d/100-compat.conf to restrict KEX to ssh2-compatible algorithms (curve25519-sha256, ecdh-sha2-nistp256, etc.) — Confirmed KEX changed from mlkem768x25519-sha256 (post-quantum) to curve25519-sha256 via ssh -vvv
  3. Generated RSA 4096 key in addition to ed25519
  4. Configured SSH config alias (~/.ssh/config with Host mac-mini)
  5. Tried multiple host formats: hostname, IP address, SSH config alias, with/without user@
  6. Added explicit Port 22 in sshd config
  7. Restricted HostKeyAlgorithms and PubkeyAcceptedAlgorithms to ssh2-compatible ones
  8. Restarted sshd via launchctl multiple times

Log Analysis (from ~/Library/Logs/Claude/main.log)

testSSHConnection: SSH connection test succeeded
getSSHGitInfo: Timed out while waiting for handshake

The internal flow shows:

  • testSSHConnectionsucceeds (SSH connectivity is fine)
  • getSSHGitInfoalways fails with handshake timeout

This suggests the issue is not with SSH connectivity itself, but with the secondary handshake that happens during getSSHGitInfo (possibly Claude Desktop's internal ssh2 Node.js library handling).

Hypothesis

Claude Desktop likely uses the Node.js ssh2 library internally (not the system's OpenSSH). Even after fixing KEX algorithms at the sshd level, the ssh2 library may have its own compatibility issues, or the getSSHGitInfo step may have a bug unrelated to SSH negotiation.

Expected Behavior

Claude Desktop should connect to Mac mini via SSH and allow remote Claude Code execution, since terminal SSH works perfectly.

Steps to Reproduce

  1. Set up two Macs on the same local network
  2. Enable Remote Login (sshd) on the target Mac
  3. Confirm terminal SSH works: ssh user@target.local
  4. Confirm Claude Code is installed on target: claude --version
  5. Open Claude Desktop → Settings → SSH → Add remote connection
  6. Enter hostname and user
  7. Observe: "Timed out while waiting for handshake"

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions