I really don't like using my root user with no password to use for logging in an Amazon EC2 ubuntu instance. I would like to login without the certificate if possible. I had seen a tutorial where they said you can, but they didn't explain how to do it.

adduser newuser
gpasswd -a user sudo

That's as far as I got. Creating a newuser username and giving them sudo priviledges. I know there has to be something I am missing for linking this to a login.


What you're asking for requires console access, and there is no console access provided by Amazon.

Your gpasswd line would also need to change to gpasswd -a newuser sudo since you created the new user using the user id newuser.

Next, you need to create a .ssh/authorized_keys file for the newuser inside of which would be the public key of the certificate (assuming by certificate you meant the .pem file).

Then you ought to be able to ssh newuser@your_public_ec2_dns.

| improve this answer | |
  • I was looking for commands to help me understand it more from theory to practice. :) – DDJ Feb 20 '17 at 15:22
  • 1
    In theory you could edit /etc/ssh/sshd_config and change PasswordAuthentication yes to allow password authentication. In theory with this, it's possible that keyboard loggers could be used to get your password, but if you only use ssh keys, then they'd have to also have your private key. This is one reason why password authentication is disabled by default. – strobelight Feb 20 '17 at 21:34

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.