maxgoedjen / secretive

Store SSH keys in the Secure Enclave
MIT License
7.16k stars 157 forks source link

[Support] Multiple SSH Server #491

Closed jonathan8devs closed 11 months ago

jonathan8devs commented 11 months ago

I need to connect to various servers in my personal environment, and each server requires its own key. However, how can I identify these keys so that my terminal uses the correct one?

The variant with:

Host *
    IdentitiesOnly Yes
    IdentityAgent /Users/me/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/socket.ssh

Host example.com
    IdentityFile /Users/me/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/PublicKeys/ertzuiolk4jhez7d89o.pub
    IdentitiesOnly yes
    User jonathan
    HostName example.com

Host example2.com
    IdentityFile /Users/me/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/PublicKeys/ertzuidfgrhez7d89o.pub
    IdentitiesOnly yes
    User jonathan
    HostName example2.com

does not work.

Load key "/Users/me/Library/Containers/com.maxgoedjen.Secretive.SecretAgent/Data/PublicKeys/ertzuiolk4jhez7d89o.pub": invalid format
jonathan@example.com: Permission denied (publickey).

It is also logical that the .pub file, which only contains the public key, does not contain a link to the private key.

How does this work?

jonathan8devs commented 11 months ago

Okay I feel a little stupid 😄 I tried again and suddenly it works.