Multiple private keys not handled correctly?

neun34tel
neun34tel
Community Member

Hi!

I have three SSH keys in 1Password. The SSH agent is set up correctly (according to 1Password itself).

My problem is, that two different devices I have ask for two specific SSH keys for the same repo. Unfortunately I want to use the third key for that repo that neither uses.
If I add the other two (public) keys to the repo, everything works on every device. But I do not want to do that. Bot keys have other purposes.

So why does 1Password not try each of the three for the repo until the one that's deposited on the repo's server works? Isn't that the intended way it's supposed to work?

Could it be I did something wrong?


1Password Version: 1Password for Linux 8.9.10 (80910043)
Extension Version: 2.5.1
OS Version: Steam OS 3.4.4 (Arch Linux)
Browser:_ Chrome Version 109.0.5414.119
Referrer: forum-search:select private key for ssh auth

Comments

  • Hi @neun34tel:

    Generally speaking, this would depend on the specific configuration of the SSH server you're connecting to. OpenSSH's default is 6 keys can be presented before disconnecting, but this can be changed, and it seems like this server has been configured to accept less keys before disconnecting. In this case, your best bet would be to configure SSH on your machine to always use that key for that server.

    To do this, first download the public key for the keypair you'd like to use from 1Password for Linux.

    Place the public key in your ~/.ssh/ directory, and give it a name like thirdkey.pub. In your ~/.ssh/config file, add a snippet that looks something like this:

    Host <mythirdrepo.com>
          IdentityFile ~/.ssh/thirdkey.pub
          IdentitiesOnly yes
    

    At this point, the remote of git@<mythirdrepo.com> will use your third key.

    If all of your repos are on the same host, the snippet would instead need to look something like this:

    Host thirdrepo
        HostName <example.com>
        User git
        IdentityFile ~/.ssh/thirdkey.pub
        IdentitiesOnly yes
    

    Then for your Git remote, rather than using git@<example.com>:user/repo.git, you'd use thirdrepo:user/repo.git. Let me know how you get on with that!

    Jack

  • neun34tel
    neun34tel
    Community Member

    Hi, Jack!

    Thanks for the answer. I just had the time to try it. Sorry I'm so late.

    It was possible to set it up so the correct key seems to be used, but now I get
    Load key "/path/to/publickey.pub": invalid format.

    The public key was downloaded (not copied) from 1Password on SteamOS (I try to set it up on my Steam Deck in Desktop mode).

  • Hobbyvores
    Hobbyvores
    Community Member

    Hi @neun34tel,
    Did you find how to fix this error? I think I followed the same way as you, but the result the same and auth not working...
    @Jack.P_1P, if you have a solution too... :x

  • neun34tel
    neun34tel
    Community Member

    Hi @Hobbyvores and @Jack.P_1P!

    The problem still persists for me as well.

This discussion has been closed.