[BUG] Claude Code Desktop SSH: Port directive from ~/.ssh/config ignored + unhelpful host verification error

Resolved 💬 3 comments Opened Feb 19, 2026 by barrettsward Closed Mar 19, 2026

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?

Bug Summary

Two issues with SSH connections in Claude Code Desktop:

  1. ~/.ssh/config Port directive is ignored. When the SSH Port field is left empty, the app always connects on port 22 rather than reading the port from the user's SSH config — despite the hint text saying "Leave empty to use default (22) or SSH config."
  1. "Host denied (verification failed)" gives no actionable guidance. When connecting to a host whose key isn't yet in known_hosts (common with non-standard ports), the error message doesn't suggest a fix. A normal SSH client would prompt the user to accept the fingerprint. The fix is ssh-keyscan -p <port> <host> >> ~/.ssh/known_hosts, but users have no way to know that from the error alone.

Environment

  • Claude Code Desktop (macOS)
  • Remote host running SSH on a non-standard port

Steps to Reproduce

Issue 1: SSH config Port ignored

  1. Configure ~/.ssh/config with a non-standard port:

``
Host myserver
HostName <remote-ip>
Port <non-standard-port>
User <username>
IdentityFile ~/.ssh/<keyfile>
``

  1. Add SSH connection in Desktop with the host field set to <username>@<remote-ip>, port left empty.
  2. Connection fails: connect ECONNREFUSED <remote-ip>:22

Expected: App reads the Port from ~/.ssh/config.
Actual: App defaults to port 22, ignoring the config.

Issue 2: Unhelpful verification error

  1. Manually set the correct non-standard port in the dialog.
  2. Connection fails: Host denied (verification failed)

Workaround: ssh-keyscan -p <port> <host> >> ~/.ssh/known_hosts resolves the issue immediately.

Suggestion: The error should either prompt the user to accept the host key (like a terminal SSH client), or at minimum display the ssh-keyscan command they need to run.

Verification

The same connection works from terminal with no issues:

ssh -i ~/.ssh/<keyfile> -p <non-standard-port> <username>@<remote-ip>

What Should Happen?

App reads the Port from ~/.ssh/config

The error should either prompt the user to accept the host key

Error Messages/Logs

connect ECONNREFUSED <remote-ip>:22

Steps to Reproduce

make a non-standard port SSH config in /.ssh/config
Add SSH connection in Desktop with the host field set to
<username>@<remote-ip>`, port left empty.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Claude 1.1.3541 (1e65e4) 2026-02-18T19:23:37.000Z

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗