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.
Best Answer
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 likewill 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