I am working to set up some deployment automation, and one of the things I'm trying is to use Ruby's Capistrano to remotely execute commands over ssh. I have used cygwin's openssh to run sshd on the box I'm using as the test victim.
Out of the box, though, this will require an identical user on each victim box, with the same password, which is clearly a bad idea.
I would like therefore to enable public-key authentication, but after a couple of days of banging my head against a wall, I'm not succeeding. Can anyone point me at a successful guide on the web to accomplish this?
I think that:
- having generated a public key locally on the overlord box, I need to run ssh-agent and then ssh-add , right? As in, not on the victim boxes.
- on each victim box, I need to cat the public key into /home/username/.ssh/authorized_keys
- I then need to ssh to the victim box like
ssh username@victim
and I shouldn't be asked for a password... right? This is the piece that is failing; I'm being asked for my password.