How to login to EC2 Linux instance if sudo password is not known?

1

I am trying to login to my EC2 Linux instance, but someone has changed the sudo password. So I could not install or uninstall any application.

kkk

Posted 2013-09-12T09:27:06.747

Reputation: 11

Answers

1

If your EC2 instance is EBS-backed, and you can shut it down, you can do the following:

  1. Stop the old instance.
  2. Detach the root volume from the old instance.
  3. Start a new instance.
  4. Attach the old volume to the new instance
  5. edit the sudoers file on the old volume you just mounted, making your user a password-less sudoer.
  6. Stop the new instance.
  7. Detach the old volume from the new instance.
  8. Re-attach the old volume to the old instance and start it up.

You should now have password-less sudo permissions.

Barak

Posted 2013-09-12T09:27:06.747

Reputation: 166