Multiple SSH private keys for the same host
Posted
by
Sencha
on Server Fault
See other posts from Server Fault
or by Sencha
Published on 2012-12-19T16:32:13Z
Indexed on
2012/12/19
17:04 UTC
Read the original article
Hit count: 250
How can I store 2 different private SSH keys for the same host? I have tried 2 entries in /etc/ssh/ssh_config for the same host with the different keys, and I've also tried to put both keys in the same file and referencing it from one hosts setting, however both do not work.
More detail: I'm running Ubuntu server (12.04) and I want to connect to GitHub via SSH to download the latest source for my projects. There are multiple projects running on the same server and each project has a GitHub repo with it's own unique deloyment key-pair. So the host is always the same (github.com
) but the keys need to be different depending on which repo I'm using.
Different /etc/ssh/ssh_config
versions I have tried:
Host github.com
IdentityFile /etc/ssh/my_project_1_github_deploy_key
StrictHostKeyChecking no
Host github.com
IdentityFile /etc/ssh/my_project_2_github_deploy_key
StrictHostKeyChecking no
and this with both keys in the same file:
Host github.com
IdentityFile /etc/ssh/my_project_github_deploy_keys
StrictHostKeyChecking no
I've had no luck with either. Any help would be greatly appreciated!
© Server Fault or respective owner