1

Scenario:

  • I have a running ec2 instance but don't have the key pair for the instance.
  • I have a ftp-user account set up but don't have root access.
  • I want to duplicate the running instance to a new instance go gain root access.

Problem:

  • When I try to create a new instance, from a snapshot of the old one, putty says "Server refused our key" when trying to ssh into it...

This is what I did:

  1. Created a snapshot of the old instance's ebs volume
  2. From the snapshot I created an image
    • Made sure the architecture and kernel-id matched the old instance
  3. I launched a new instance from the image
    • Created a new key pair
    • Created a new security group and made sure port 22 was open
  4. Assigned an elastic ip to the instance
  5. I downloaded and converted the key pair .pem file with puTTYgen
    • Loaded .pem file into puTTYgen
    • Used SSH-2 RSA 1024
    • Saved private key
  6. Tried to ssh into the instance with putty (BUT FAILING)
    • Used elastic ip address
    • Tried with usernames: "ec2-user", "root", "ubuntu", "bitnami"

What could be wrong?

askedJun 23, 2013 at 10:31
a_b's user avatar
1

1 Answer1

3

The image and your new instance still use the original keypair. Unless you prepare the instance to accept a new key at launch, it will not.

What you need to do is attach the volume to a new instance entirely, (created from a public ami). Mount the volume and edit the user'sauthorized_keys file on that volume. Put in your new key, and then move it back to the original instance.

answeredJun 23, 2013 at 13:30
datasage's user avatar
Sign up to request clarification or add additional context in comments.

1 Comment

thanks, step-by-step description of your above answer found here:stackoverflow.com/questions/7881469/…

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.