6

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?

migrated from stackoverflow.com Jul 16 '12 at 17:34

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

5

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.

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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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