Default SSH Usernames For Connecting To AWS EC2 Instances 2018

Default SSH Usernames For Connecting To AWS EC2 Instances 
Each AMI publisher on EC2 decides what user (or users) should have ssh access enabled by default and what ssh credentials should allow you to gain access as that user.
aws,ssh,aws ec2 ssh,ec2,amazon aws,aws cloud,ssh file transfer protocol (protocol),ssh keygen,amazon web services,amazon,ssh aws ec2,aws ec2 linux launch connect ssh,ssh into aws ec2,ssh en aws,aws connecting to your linux instance using ssh,ssh aws mac,how to ssh into aws ec2 instance from mac,aws ec2 ssh mac,how to ssh into aws ec2,linux,cloud,tutorial,instance,putty,aws reinvent,ssh,ssh exposed,linux,tutorial,ssh linux,ssh key,ssh windows,server,ubuntu,shell,secure shell (protocol),s.s.h.,prettyboyfredo,prettyboyfredo exposed,windows,computer,terminal,mascot,music,openssh,secure,secure shell,bitvise ssh client,what is ssh,how to join ssh,ssh command,ssh videoscribe,ssh in hindi,ssh configuration,reverse ssh,cara membuat ssh,cara membuat ssh 1 bulan,cara membuat ssh 30 hari,ssh vs p2,ssh sgdo

For the second part, most AMIs allow you to ssh in to the system with the ssh keypair you specified at launch time. This is so common, users often assume that it is built in to EC2 even though it must be enabled by each AMI provider.
Unfortunately, there is no standard ssh username that is used to access EC2 instances across operating systems, distros, and AMI providers.
Here are some of the ssh usernames that I am aware of at this time:
OS/Distro Official AMI
ssh Username
Legacy / Community / Other AMI
ssh Usernames
Amazon Linux ec2-user
Ubuntu ubuntu root
Debian admin root
RHEL 6.4 and later ec2-user
RHEL 6.3 and earlier root
Fedora fedora ec2-user, root
Centos centos root
SUSE ec2-user root
BitNami bitnami
TurnKey root
NanoStack ubuntu
FreeBSD ec2-user
OmniOS root
Even though the above list will get you in to most official AMIs, there may still be situations where you aren’t quite sure how the AMI was built or what user should be used for ssh.
If you know you have the correct ssh key but don’t know the username, this code can be used to try a number of possibilities, showing which one(s) worked:

for user in ec2-user ubuntu centos fedora admin bitnami root
if timeout 5 ssh -i $keyfile [email protected]$host true 2>/dev/null; then
echo "ssh -i $keyfile [email protected]$host"
Some AMIs are configured so that an ssh to [email protected] will output a message informing you the correct user to use and then close the connection. For example,
$ ssh [email protected]<UBUNTUHOST>
Please login as the user "ubuntu" rather than the user "root".
When you ssh to a username other than root, the provided user generally has passwordless sudo access to run commands as the root user. You can use sudossh, and rsync with EC2 hosts in this configuration.
If you know of other common ssh usernames from popular AMI publishers, please add notes in the comments with a link to the appropriate documentation.
Amazon has added a list of some default ssh usernames in their documentation. Depending on the month, it may be more or less up to date than this article:
Share This:

Leave a Reply