-2

Is there a way to discover or specify the username I need to use to ssh in to an ec2 instance? I know how to select my key pair, but depending on the ami, you need to use a different username.

For example, the official ubuntu images require you to ssh in with ubuntu@..., the debian images with root@... and the fedora images with ec2-user@.... However, sometimes I just want to search an ami from the 'community AMI's', but then I don't know which username my keypair was associated with.

So how is one supposed to know this? Is there a way to specify this when launching the instance? Am I overlooking something?

4
  • 5
    This is, unfortunately, a "look in the documentation" situation.
    – Skaperen
    Feb 9, 2013 at 9:53
  • 1
    What do you mean exactly? The AMI's don't really come with any documentation? Feb 9, 2013 at 21:45
  • @Jeroen We can't answer this for you (especially as you haven't seen fit to tell us which AMIs you're asking about - there are a LOT of them). Only the person who created the AMI can tell you what the default usernames are. You need to ask the person, organization, or other entity that created the AMI.
    – voretaq7
    Feb 10, 2013 at 0:26
  • Ok, that answers the question. IMHO, it would make sense to let the user specify this username, along with the keypair, when launching the instance. I am still not sure why the username is hardcoded by the ami creator, whereas the pubkey for this user can be specified by the user. Why else would they let me pick an AMI from the community repository? Feb 10, 2013 at 3:50

2 Answers 2

1

Remember Amazon AMIs can be customized as well as created from scratch by anyone. So in theory, anyone can change the ssh user to any random user. As you mentioned the most common users are ubuntu, ec2-user and root, but there are some users who bundle their own AMIs and change the usernames to a different user for security reasons, to make it unpredictable. So either you have to rely on the documentation of the AMIs to see what user to use, or to try the conventional user names.

1
  • Thank you this answers the question. It's a bit counter intuitive for me though: they do let you specify a keypair on launch, but don't tell you which username this keypair will be given. Not sure if and how this really improves security. Feb 10, 2013 at 3:53
0

This is from Amazon Docs AWS DOCS

In User name, enter the user name to log in to your instance.

Note For an Amazon Linux instance, the default user name is ec2-user. For Ubuntu, the default user name is ubuntu. Some AMIs allow you to log in as root. So in this example, you may need to change the user name from ec2-user to the appropriate user name.

1
  • This basically just restates the question...
    – ceejayoz
    Feb 9, 2013 at 23:17

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