0

I’ve created a user called ‘deploy’ on my remote server and I’ve tried adding my public id_rsa.pub key to its .ssh/authorized_keys file (which I created), but I can’t connect to it. When I try to ssh into it I get "Permission denied (publickey)."

Here's what I've tried so far:

  1. Placing my rsd_id.pub key into the 'deploy' user's .ssh/authorized_keys file using:

    sudo su - deploy

    echo "long string key here" >> .ssh/authorized_keys

Then I cat .ssh/authorized_keys to confirm it's really there, which it is.

Then sshing by doing

ssh deploy@ec2-8380398230802.hostnamestuff.amazon.aws.com 'hostname; uptime'

I get the same Permission denied (publickey) with that.

  1. I placed the rsa_id.pub key inside aws's keypairs. Same error.

What might be the issue here?

1
  • 1
    Are you sure that the ssh client is using the correct private key? Try specifying it exlicitly using the -i switch, e.g.: ssh -i ~/.ssh/my_private_key ... Mar 12 '15 at 17:49
0

I believe the answer was to change the permissions for my .ssh and .ssh/authorized_keys director and file to 700 and 600 respectively. I thought I'd done this already but it now works. Who'd have known!?

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.