I'm using ami-c2a255ab. It is up and running. I can SSH to it. But when it asks for password for any sudo command - I have nothing to say.

Where can I get this info?


I understand you are using Ubuntu on EC2 and you have logged in successfully using SSH keypair authentication.

You don't need the root password to use sudo, that's the point of sudo.

Set the password for your current logged in user using the command, "passwd".

If your user is already in the sudoers file, then you should now be able to sudo using the password you have just set.

  • And if it's one of the prebuilt Ubuntu AMIs the ubuntu user doesn't even have a password. – Johanna Larsson Nov 28 '10 at 14:50
  • Rich, you were right. That was my mistake. It all was caused by messed up sudoers file. It has nothing to do with AMI, itself. Thank you – user45286 Nov 28 '10 at 15:00

The Amazon documentation on safely using shared AMIs actually lists steps for a good shared AMI that suggests either setting a randomized root password on startup or completely disabling root password and using SSH identity key that is installed on bootup. The AMI you've mentioned specificially is an EBS backed instance image so if it had set a randomized password it would be retained so you would have needed to remember it. Otherwise if it installed the SSH identity file you'd need the private key data portion of it which you could determine which was used by the Key Pair Name in the instance description.


Sounds like there is no password set so you'll need to login using the SSH keypair method.

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.