Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

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

 
discard

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.