What is the default username for Amazon AMI images of Ubuntu Server?

91,684

Solution 1

On EC2 all the Ubuntu AMI's should be connected to like so:

$ ssh -i your-ssh-key.pem [email protected]

So you connect as the 'ubuntu' user using the ssh key you injected into the instance at launch (not a password). Once authenticated, you can issue password-less root commands with sudo.

(note: your ssh key might be .priv, or .pem, or no extension, this is just an example)

Here are also some handy resources about connecting to EC2 instances:

Launching an instance and choosing or creating a new SSH keypair: http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/index.html?LaunchInstance.html

Connecting with your ssh keypair: http://docs.amazonwebservices.com/AWSEC2/latest/GettingStartedGuide/index.html?ConnectToInstanceLinux.html

What they don't mention there is that you connect to Ubuntu instances with the 'ubuntu' account and not root.

Solution 2

Extra tips:

  1. I prefer to type ssh ubuntu@host instead of ssh -i your-ssh-key.pem ubuntu@host.

    I wrote an article that describes how to do this:

    Uploading Personal ssh Keys to Amazon EC2
    http://alestic.com/2010/10/ec2-ssh-keys

  2. If you're always logging in to EC2 hosts using ubuntu you can even make that the default for when you use the standard EC2 instance public host name. This lets you just type ssh hostname. To do this, edit $HOME/.ssh/config and add a section like:

    Host *.amazonaws.com
      User ubuntu
    

Solution 3

As a further option, if you don't want to use personal ssh keys (although probably the best solution) but want to simplify the command line, add your key to ~/.ssh/ and add the following to ~/.ssh/config:

Host ec2-xxx-xxx-xxx-xxx.xxxx.compute.amazonaws.com
 User ubuntu
 IdentityFile ~/.ssh/yourkey.pem

Then you can simply use ssh ec2-xxx-xxx-xxx-xxx.xxxx.compute.amazonaws.com

If you have your EC2 registered to a domain then you can also use the following:

Host yourdomain.com
 User ubuntu
 IdentityFile ~/.ssh/yourkey.pem

Then you can use ssh yourdomain.com

Finally, to simplify it without a domain, use an alias as follows:

Host myalias
 HostName ec2-xxx-xxx-xxx-xxx.xxxx.compute.amazonaws.com
 User ubuntu
 IdentityFile ~/.ssh/yourkey.pem

Then you can use ssh myalias

Solution 4

For community AMIs created by Bitnami, the username is 'bitnami'.

Here's the section in Bitnami's Quick Start Guide, for reference:

How to log into the BitNami Virtual Machine.

Solution 5

The nologin script on the root user tells you (via ssh -i pem.pem root@<private.ip.ec2.instance>) which user you should use instead.

In some AMI images that is ec2-user. So ssh -i pem.pem [email protected] In ubuntu AMI images that is ubuntu. Then in managed instances it's different again; EMR nodes have hadoop.

YMMV therefore check with trying root.

Share:
91,684
David Parks
Author by

David Parks

Updated on September 18, 2022

Comments

  • David Parks
    David Parks about 1 year

    I just launched one of the Ubuntu Server AMI's on Amazon EC2.

    I connect just fine, but I don't see anything to tell me the default login credentials.

    login as: ?
    
  • David Parks
    David Parks about 12 years
    How do I determine "external.dns.name"? I've tried the public DNS, the text as you wrote it, etc. without success.
  • David Parks
    David Parks about 12 years
    I'm using PuTTY to connect, I've connected to other linux instances, but every attempt at logging in as ubuntu, or ubuntu@anything_I_can_think_of fails, I'm clearly missing some detail.
  • Mark Russell
    Mark Russell about 12 years
    Yes. You when you look at the properties of your instance, you should take the "Public DNS" to use for the hostname.
  • Mark Russell
    Mark Russell about 12 years
    In PuTTY, ubuntu is the user name, there is no password, and "Public DNS" is the host to connect to. Apparently you need to convert the .pem file you get from Amazon when you create your keypair. The details of that are on the second AWS doc I posted.
  • David Parks
    David Parks about 12 years
    I've got it now, it's just 'ubuntu' user and the key, when done correctly it works fine as you said. Thanks very much for the help!
  • Mark Russell
    Mark Russell about 12 years
    Nice! Thanks, Eric. I've just kind of lived with my way. It appears I should go back and scour your blog again. Sweet.
  • belacqua
    belacqua over 9 years
    ? No mention of bitnami in the original....
  • Octopus
    Octopus over 9 years
    There are lots of 'Amazon AMIs' available that run ubuntu servers. They are not all setup for 'ubuntu' user. I had the exact problem myself. The answers above did not apply to the 'Amazon AMI' that I chose, which was a turnkey Plone deployment. I am sure there will be many other Community AMIs whose logins aren't obvious. In fact, I could have asked the same question and it would have worded exactly the same way the op did.
  • belacqua
    belacqua over 9 years
    As the question was from 2011 and has an accepted answer, I don't find it plausible that 'many other community AMIs' were in the scope. This was almost certainly based on the 'official' Ubuntu image. If it was a non-Canonical image, then the question should have been clarified.
  • belacqua
    belacqua over 9 years
    IMO, it should be a new question and answer. Seems valid ; I'd certainly up-vote it.
  • Mayank Jaiswal
    Mayank Jaiswal about 8 years
    On systems other than ubuntu, default username is ec2-user. Example centos.