Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Amazon EC2-instance: I made a user 'admin' and copied ec2-user's keys with proper permission. After successful login, i tried to do sudo su for root access, it says 'admin is not in the sudoers file. This incident will be reported.'

However i can do sudo su with ec2-user account and can gain root access.

What is sudoer file? how does ec2-user and admin different in config wise?

# useradd -m admin
# cp -R /home/ec2-user/.ssh /home/admin
# chown -R admin:admin /home/admin/.ssh

connect by putty: login as: admin Authenticating with public key "xxx" [admin@ip-xx-xx-xx-xx ~]$ sudo su

We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: 1) Respect the privacy of others. 2) Think before you type. 3) With great power comes great responsibility.

[sudo] password for admin:
admin is not in the sudoers file.  This incident will be reported.
share|improve this question

1 Answer 1

up vote 1 down vote accepted

You need to edit your sudoers filer and enable your admin user. You should only edit your sudoers file with the visudo command as this checks the syntax etc. Something like

admin    ALL=(ALL) ALL

will do. This allows your admin user to execute any command as on any host as any user after supplying a password.

Check the sudoers and sudo man pages

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.