Skip to content

Connecting to EC2 instance via SSH

0

So I am not able to connect to my EC2 Instance via SSH, thats why I am trying to connect via serial console, to remove fire wall blocs and see if SSH is in listning state but then in Serial console I should login as OS level user but I dont have password for any OS level users, where can I get the credentials from without loggin in as I cannot login if I dont hsave password?, vcan I get the password from AWS without using console?

asked a year ago182 views

2 Answers
6

Would suggest:

  1. Stop the affected instance.
  2. Detach the root EBS volume from it.
  3. Attach the volume to a temporary EC2 instance (same OS preferred).
  4. SSH into the rescue instance and mount the attached volume.
  5. Chroot into the mounted volume:
  6. Set a new password using passwd ec2-user or passwd root
  7. Unmount and detach the volume, then reattach it to the original instance as /dev/sda1.
  8. Start the original instance and SSH in as usual.
EXPERT

answered a year ago

  • It's my EMR on EC2 cluster, not just the EC2 instance. Does this solution still work?

0

You can also try logging in using SSM Session Manager. To login with SSM, the EC2 will need to have an IAM role and it must have the SSM agent installed. Complete instructions here - https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started.html

EXPERT

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.