Re-gaining root access to an EC2 EBS-boot image
You can mount the EBS volume to another instance.
- Set the problematic instance to "Stop"
- 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.
- Detach the drive and mount it to a working instance
- Modify it
- Detach it from the working instance
- 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.