Amazon Community AMI: How to know root password?

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?


Solution 1:

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.

Solution 2:

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.