- Newest
- Most votes
- Most comments
If you are connecting through instance connect - There is an option to change the default (available through the ami )user in the "Username" field.
If you are using ssm session manager - Refer to this - https://repost.aws/questions/QUpJoQ5PvBSYSzf_MkhmGv8g/how-can-i-changed-to-ec2-user-automatically-when-i-access-aws-linux-ec2-via-session-manager
If you want to change the user after logging in - sudo su - ec2-user should switch the user from root to ec2-user
answered 2 years ago
While the answers provided above are helpful, I highly recommend taking some time to review the following documentation. It will give you a deeper understanding of how system users work on EC2 instances and how you can connect to them effectively:
These resources will help you not only with your current issue but also with managing your EC2 users more efficiently in the future.
answered 2 years ago
Relevant content
asked 6 years ago
asked 2 years ago

Hello buddy,
The user by which we try to login is depends on ami we use.
If your copying the command to login to your instance then there might be a case sometimes aws gives you diff command. You can simply follow the command
Amazon linux ssh -i name_of_keypair.pem ec2-user@public.ip.address.of.ec2
Ubuntu ssh -i name_of_keypair.pem ubuntu@public.ip
It's different with different linux distribution.