Where is the password for newly created EC2 user?

0

1

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.

Bruce

Posted 2017-05-25T21:14:59.243

Reputation: 23

Answers

1

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.


sudo

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
newuser ALL=(ALL) NOPASSWD:ALL

That tip is from here.

James T Snell

Posted 2017-05-25T21:14:59.243

Reputation: 5 726

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 – 2017-05-26T13:03:23.723

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 – 2017-05-26T16:56:46.750

Good point. I need to re-think why creating newuser. – Bruce – 2017-05-30T13:36:03.823