Super User is a question and answer site for computer enthusiasts and power users. 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

Say I connect to Amazon's EC2 service for multiple clients, where each client has their own ssh settings and secret keys etc.

Is there a way I could swap the settings for each client?

I'm on OS X.

share|improve this question
Are you looking for a way to synchronize the ssh configurations for each client? I'm not sure what you mean from your question. – bobmagoo Aug 23 '12 at 16:42
Do you want to have the systems setup so the same key pair grants you ssh access to every system? – chuck Aug 23 '12 at 17:54
I want to connect to each one without having to manually change my environmental variables etc. since connecting to ec2 assumes an environtal variable during ssh connection. – user1361315 Aug 23 '12 at 18:10
up vote 1 down vote accepted

Well, an easy way to do this, would be to put each key in ~/.ssh and then create a file in ~/.ssh called config

inside config you would then put lines like this for each host/key pair

IdentityFile ~/.ssh/key1
User username_on_host1

IdentityFile ~/.ssh/key2
User username_on_host2


then when connecting to each server it will use the proper usernames & keys

You could go further, by editing /etc/hosts and put shortened names for the IP addresses that your connecting to like such    host1

then in your config file you can just put host1 instead of

This way your clients get the added benefit of separate security instead of sharing the same key across all clients.

Edit: You should also

chmod 644 ~/.ssh/config
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .