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:
- Created a snapshot of the old instance's ebs volume
- From the snapshot I created an image
- Made sure the architecture and kernel-id matched the old instance
- 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
- Assigned an elastic ip to the instance
- I downloaded and converted the key pair .pem file with puTTYgen
- Loaded .pem file into puTTYgen
- Used SSH-2 RSA 1024
- Saved private key
- 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?
- 1seestackoverflow.com/questions/7881469/…yegor256– yegor2562013-06-23 14:14:36 +00:00CommentedJun 23, 2013 at 14:14
1 Answer1
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.
Sign up to request clarification or add additional context in comments.
1 Comment
a_b
thanks, step-by-step description of your above answer found here:stackoverflow.com/questions/7881469/…
Explore related questions
See similar questions with these tags.

