Certified Security - Specialty

Sign Up Free or Log In to participate!

Private key lost for accessing ec2 instance .. how do you gain access to it again ?

You are trying to connect to your Linux EC2 instance, however you have lost your private key. Which of the following steps do you need to perform in order to access your instance again?

exam saying option 3 is correct and I feel option 4 is correct.  How can we just edit a authorized_key file which is attached to different ec2 instance as a data volume. and get access back when you lost your private key?. I am totally not getting this.. Please give your response and answers

Stop the instance, detach its data volume and use it to launch another instance, create a new key pair at launch time.

Stop the instance, detach its data volume and attach it to another instance, modify the authorized_keys file, move the volume back to the original instance. Restart the instance.

Stop the instance, detach its root volume and attach it to another instance as a data volume, modify the authorized_keys file, move the volume back to the original instance. Restart the instance.

Stop the instance, detach its root volume and use it to launch another instance, create a new key pair at launch time.SELECTED

1 Answers

Indeed option3 looks the most comprehensive. For option 4, at the end of those steps, your data volume is still mounted onto the stopped instance.

For option 3 is not just do-able, but the only way to do back in the good ol’ days. It’s akin to taking out a hdd from an old computer put it into a external hdd drive, and then use a separate OS to change the authorized_keys file. Once you attach your root volume as a data volume on a separate EC2, you’ll have access to the files on that volume, hence you can simply add an additional key to the authorized_keys file, or even just replace the file completely.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?