Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a user with more than one key-pair for SSH. Is that possible? Is that possible without having to specify which key to use on each command?

share|improve this question
up vote 9 down vote accepted

You can have multiple SSH keys (multiple identities). To use the at the command line add a -i option, e.g.

ssh -i .ssh/id_dsa_host_1 host_1

If you have a key for each server you can add the info in the .ssh/config file (see man ssh_config for details), e.g.

Host host_1
IdentityFile ~/.ssh/id_dsa_host_1

Host host_2
IdentityFile ~/.ssh/id_dsa_host_2
share|improve this answer
ssh-agent can also be used to add multiple keys. – Warner Mar 24 '10 at 13:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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