Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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'm trying to set up ssh keys and I don't do this often. That said, I have 3-4 key pairs in my .ssh/ dir already. WHen I do ssh how does ssh know what key to use?

I don't want to have key per site, but rather use one private key for lots of sites, and put the public key on the remote server. Sometimes my username on the server is not the same as my local username (often). How does SSH know which key I want to use?

share|improve this question

migrated from Jul 16 '12 at 17:34

This question came from our site for professional and enthusiast programmers.

There is an option called "IdentityFile"...

I suggest reading a little bit about ssh.config. It is worth it. You can configure the key, port, user name...

share|improve this answer
up vote 2 down vote accepted

I also found the -v option while connecting and it shows what it's doing. Turns out, it tries a bunch of keys that it finds in the .ssh dir. Basically tries whatever's in there.

share|improve this answer

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.