Default ubuntu user deleted, unable to access EC2 Instance via SSH

wonder95 asked:

This is my first foray into using EC2, and I created my first instance using an Amazon AMI running Ubuntu 12.04. I created a keypair and downloaded the .pem file to my local machine. I was able to connect via SSH via the ubuntu user just fine. I then created another user using the useradd command, and after a few tries, it was finally created. However, somehow in the process of creating that user, the default ubuntu user was deleted. I logged out of the instance, and now when I try to log in as my new user account, I get “Permission denied (access key).” I didn’t have my public key created in my .ssh directory for my new user on the server, but even so, shouldn’t I still be able to use SSH with my password? That’s what has worked for me on other servers.

I’ve tried importing another key pair in the management console, but that hasn’t helped. In terms of access groups, I just have the default group that grants access on port 22.

If I can’t get in, it seems my only other option is to delete the instance and create another one. Is there a way to access the one I have?

Thanks.

My answer:


Many EC2 AMIs, especially Ubuntu’s, have SSH password authentication disabled by default. So if you don’t have a key in place, you can’t log in, at all.

If you only just created the instance, then delete it and start over.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.