I'm using chef to build a server.
I generated a passwordless SSH keypair on one server and added the public & private keys to chef. After testing, it worked.
When I provision another server and copy the keys over and try to use them it prompts me for a passphrase.
Running ssh with debug info, I get the message:
"key_parse_private_pem: PEM_read_PrivateKey failed"
How can I copy SSH keys between servers and have them work?
The only thing I can think of is that since the hostname has changed, and I can see the user & hostname in the public key, that it's also in the private key. Somehow the hostname changing prevents the keys from working?
This is my git key - nothing to do with authorized_keys. When I try to clone my repo I get asked for the passphrase.
Here's the process I went through:
- Spin up new server on AWS.
ssh-keygenas my 'web' user.
- Confirm I can clone my git repo.
- Copy my
id_rsa.pubfiles from the AWS instance into chef. Note the permissions.
- Spin up a new server and copy over the
/home/web/.ssh(all perms the same).
- Try to clone my git repo - I get prompted for a password. Try to just ssh to git server (bitbucket) - same thing (so not a git issue).