Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to set a password for root on EC2 AMI Linux. I have tried with passwd root but if I log in with ec2-user and run sudo su, I get a root bash without asking for a password.

share|improve this question
up vote 4 down vote accepted

sudo su asks for the user's password, the user has to be in the sudo/adm/admin/wheel group (depening on flavour of the OS) to be able to execute sudo.

The root password will be prompted when using su alone.

Check the settings in /etc/sudoers file to see why you are not being asked for a password while using sudo. Most likely the time-out is set to a few minutes, allowing you a passwordless sudo for e.g. 15 minutes after a successful password entry.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.