Skip to content

ax ssh fails when too many ssh keys already exist #58

@er4z0r

Description

@er4z0r

Background:

  • using the latest ax version (ax update says it is fine)
  • using Digital Ocean
  • I have several ssh private keys for different purposes

Problem

When I try to connect to my fleet instances I receive an error message:

ax ssh <targetinstance>
Received disconnect from xxx.xxx.xxx.xx port 2266:2: Too many authentication failures
Disconnected from xxx.xxx.xxx.xx port 2266

This is usually a clear indication that ssh is trying all my private keys before it reaches the one configured in ~/.axiom/axiom.json. I was able to confirm this by removing all my keys from the ssh-agent, which results in axiom connecting normally.

Workaround

I managed to fix the problem by:

  1. ax ssh --just-generate (to generate ~/.axiom/.sshconfig)
  2. ax ssh --just-generate cache (to prevent ax from overwriting my modified config)
  3. Modify ~/.axiom/.sshconfig by adding: IdentitiesOnly yes right below the line that says IdentityFile
  4. Retry ax ssh <targetinstance> this time with success

Suggested fix

Since ax is using a specific pubkey anyway, it might make sense to add that IdentitiesOnly yes to .sshconfig by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions