ssh Password-less login to multiple machines when you already have one

Posted by tandu on Super User See other posts from Super User or by tandu
Published on 2012-03-26T16:58:14Z Indexed on 2012/03/26 17:32 UTC
Read the original article Hit count: 202

Filed under:
|
|

I'm a little bit confused about setting up a password-less login for multiple machines to begin with, but I think I could do it from scratch. The problem is I already have it set up for one machine and I don't want that to be blown away when I try to set it up for the other machine. Let's clarify:

  • Machine A: the machine I'm connecting from
  • Machine B: the machine I'm connecting to. Password required
  • Machine C: the machine I'm connecting to. Password-less ssh

I have read some tutorials on setting up password-less ssh to a certain site, but they usually start with "move id_rsa out of the way so it doesn't get blown away," but then at the end of the tutorial it's not moved back. If I had no help at all, here is what I would do:

  1. Log into B
  2. ssh-keygen -t rsa -f ~/id_rsa.other
  3. scp id_rsa.other.pub A:~/.ssh
  4. echo "Host A \n Identity File ~/.ssh/id_rsa.other" > ~/.ssh/config

(Note that I realize these commands may not be exactly correct, but this is just the idea).

What I'm not quite clear on is if I need to update the config for A, B, or both. I'm fairly certain to do a password-less login from A to B, it is A that needs the public key .. but I also suppose I need B to use the correct id_rsa file for that public key. Finally, I don't want the password-less login for C to be affected at all .. it's using id_rsa. Am I going wrong anywhere?

© Super User or respective owner

Related posts about ssh

Related posts about passwords