You are not logged in.

#1 2016-06-11 11:50:48

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

adding the second keys pair to .ssh

Hi!

I have placed the second ssh keys pair as ~/.ssh/identity[.pub]. Also, I use enabled/running gpg-agent service (with --user flag) with SSH support. After logging in to be able to use the second pair I must invoke ssh-add <path to key> and restart gpg-agent.

So, the question is: how to configure all this mechanics to avoid manual manipulations?


"I exist" is the best myth I know..

Offline

#2 2016-06-11 12:12:04

TheChickenMan
Member
From: United States
Registered: 2015-07-25
Posts: 354

Re: adding the second keys pair to .ssh

man ssh_config

There are a couple of examples in the wiki too.

Last edited by TheChickenMan (2016-06-11 12:14:42)


If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet.
Niels Bohr

Offline

#3 2016-06-11 12:42:33

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: adding the second keys pair to .ssh

TheChickenMan wrote:

man ssh_config

There are a couple of examples in the wiki too.

I have tried ~/.ssh/config containing

Host *
     IdentityFile ~/.ssh/id_rsa ~/.ssh/second

without success. As well as

Host *
     IdentityFile ~/.ssh/id_rsa
     IdentityFile ~/.ssh/second

Last edited by student975 (2016-06-11 12:51:33)


"I exist" is the best myth I know..

Offline

#4 2016-06-11 12:55:35

TheChickenMan
Member
From: United States
Registered: 2015-07-25
Posts: 354

Re: adding the second keys pair to .ssh

It parses from the top of the file, taking whatever the first match for "Host" is. Since you have Host * that will match everything. You need a more specific Host for the first entry and then either a second specific one or a general one. Ex:

Host 10.0.0.1
IdentityFile ~/.ssh/ssh_auth_1

Host 10.0.0.*
IdentityFile ~/.ssh/ssh_auth_2

Host *
IdentityFile ~/.ssh/ssh_auth_general

If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet.
Niels Bohr

Offline

#5 2016-06-11 13:19:32

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: adding the second keys pair to .ssh

Thanks!

At the moment I'm just forced to restart gpg-agent. It seems the last one starts (with --user) too early, and some "After" (or what) must be added to .service file.


"I exist" is the best myth I know..

Offline

Board footer

Powered by FluxBB