0

I have the ~/.ssh/config file I'm using to manage different keys from different hosts.

However, each time a new key is added, I'll need to also manually add this to ssh agent via ssh-add for separate reasons.

Is there a way this can be achieved automatically? if yes, how?

P.S: If it's any useful, I'm also using a macbook (osx)

  • I think that you are going to have to write some type of scripting to do this. – mdpc Mar 21 '17 at 0:32
1

Implementing the case you specially worded in your question would be complicated and would require some bash scripting, which I don't recommend for such simple task.

But very similar thing can be achieved using AddKyesToAgent option in ssh_config, that will basically add the keys to ssh-agent when it is used for the first time. This option is available since OpenSSH 7.2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.