5

I have a running AWS vm. The only access I have is using the ssh key (.pem file) to log in as ec2-user which is an unprivileged user. From there, I could user the sudo command without a password.

Somehow, passwordless sudo got disabled and it is asking me for the ec2-user password. But this password was never set, it is scrambled.

  1. How do I regain root/sudo access? Or am I forced to start from scratch?
  2. How did this happen? I never touched the /etc/sudoers file
  • 6
    Have you contacted the Amazon people? – mdpc Oct 7 '14 at 6:10
  • I am not familiar with the amazon vms. But you might know, that if you have a console access to the machine you can boot it with init=/bin/bash. – cornelinux Oct 7 '14 at 7:11
  • 1
    @cornelinux there is no console access for EC2 vms. – Iain Oct 7 '14 at 7:27
9

Can't say for sure why it happened. If your sudo rule was based on your user being part of a specific group (e.g. wheel or sudo) and you were removed from that group that would explain it.

You shouldn't need to blow your instance away, but you will need to stop it (not terminate) and attach the disk to another instance where you have root access so it can be fixed. More information from Amazon's website

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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