I am trying to access an ec2 instance using a different (mac) computer. In order to do so, I created a new keypair, used chmod 600 to set the permission, and then used ssh-add. When I try to ssh into my ec2 instance, I get “permission denied (publickey)”. I’m sure my error is something idiotic and simple, but I can’t seem to find it, can anyone help me out?
Share
You need to ensure the
~/.ssh/id_rsa.pub(if it’s an RSA key) from your Mac is appended to the~/.ssh/authorized_keysfile on the target machine. Normally, if this is a default Amazon API, the user is “ec2-user” —~ec2-user/.ssh/authorized_keysREMEMBER TO APPEND and not remove other entries in that file — else, you risk locking yourself out of that machine …