I created a newuser on EC2 following this document AWS doc. Now I can use this user to SSH to the EC2 instance. The only issue is that every time when I need to use sudo (for example, when I do sudo yum update), it asks for password:

[sudo] password for newuser:

I created a password for newuser but this password does not work.


The procedure given in the article you linked does not have you set a password, so there is no password.

To set a password, login as a user that is allowed to sudo and run:

sudo passwd newuser

You will have to enter the password for newuser twice and then it should be set.


If you want newuser to be allowed to sudo, then you'll have to also edit /etc/sudoers to add a line such as:

# User privilege specification

That tip is from here.

  • I set a password for newuser. I typed this password when asked, it says newuser is not in the sudoers file. This incident will be reported. – Bruce May 26 '17 at 13:03
  • Looks like you're going to gitmo! In the meantime, I've updated my answer to explain extending sudo support to a new user. It is not automatically given to users, as it's full admin and doing so would defeat most of the point of even having users. – James T Snell May 26 '17 at 16:56
  • Good point. I need to re-think why creating newuser. – Bruce May 30 '17 at 13:36

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.