Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 my_user@mydomain.com 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 stackoverflow.com Jul 16 '12 at 17:34

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

2 Answers 2

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

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

 
discard

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.