Today I tried to ssh to my AWS instance, as usual but got a "Permision denied" error with -v giving me the following:
debug1: Next authentication method: publickey
debug1: Offering RSA public key: localuser@localmachine
debug1: Authentications that can continue: publickey
debug1: Trying private key: serverkey.pem
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
If I try to log as root@my-ip.com it will authenticate, but show the message: "Please login as the user "ubuntu" rather than the user "root"."
Last time I logged I created a new user for a web page within a new group "webapps". I assigned the home directory of this user to be the same as the ubuntu user since it was convenient. I have also tried to log in as this user with no success.
Also, I tried generating a new pair of keys (loacally and uploading the public key, and from the AWS console and saving the private key locally).
I would really appreciate if someone can help me!
Edit:
The command I use normally is ssh -i serverkey.pem ubuntu@my-ip.com
after failing I generated the ssh key locally and uploaded it to AWS and used ssh ubuntu@my-ip.com
with the key stored at ~/.ssh
For anyone stumbling here I think my problem was assigning the second user's home folder to ubuntu's home folder. Since this is insecure it messes with the SSH connection. I had to make another instance and recover the info attaching the old volume to the new server instance.