2

I'm using an Alestic image which disables root SSH logins, but provides a user "ubuntu" with NOPASSWD sudo privileges. See here.

In the course of trying to add a new user to the sudoers file I inadvertantly created another line for the "ubuntu" user, this time without NOPASSWD. I have now apparently lost root access to this machine.

Is there some way to mount the EBS root volume on a different instance (fixing the sudoers file) and then re-launch the server?

Or am I totally screwed?

2 Answers 2

5

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"
1
  • Haven't had the opportunity to test this, but marked as answered since I assume it will work. Thanks.
    – jberryman
    Feb 15, 2011 at 18:03
2

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.

2
  • Thanks for the answer. I hadn't considered that maybe there would be no password set. Unfortunately passwd asks for my current password. I think the 'ubuntu' account may have been created with $ adduser --disabled-password ubuntu. Any other ideas?
    – jberryman
    Feb 10, 2011 at 22:01
  • I only tested it with a user that had no password rather than a --disabled-password user. I've set this up but can't find a way around it atm.
    – user9517
    Feb 10, 2011 at 23:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .