Re-gaining root access to an EC2 EBS-boot image

You can mount the EBS volume to another instance.

  1. Set the problematic instance to "Stop"
  2. Identify the EBS volume mounted to the problematic instance via the instance-id it should be listed like any other EBS volume on the web console.
  3. Detach the drive and mount it to a working instance
  4. Modify it
  5. Detach it from the working instance
  6. Re-attach the drive back to your original problematic instance and set to "Start"

If the ubuntu user has no password and the problem is that sudo requires a password have you tried giving the ubuntu user a password ?

ubuntu@host$ passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Edit - I've just had an opportunity to test this and can confirm that setting a password for the ubuntu user will let you regain access to sudo.

Having a password on the account is a Good Thing tm anyway.