Deleted authorized_keys from EC2 but still have PPK file and I’m connected

amazon ec2ssh-keygenssh-keys

I just deleted my full ec2-user/.ssh/ folder and I want to recover the keys so I can access my EC2 server without stopping and starting it.

I have on my computer a PPK file that has something like "Private-Lines" so I'm guessing it has both private and public key… I've tried a lot of things without success so, what are the step by step instructions to recover my keys to the server using this PPK key?

I'm still connect via SSH 🙂

Best Answer

Ok, this is really easy:

  1. Open puttygen
  2. Click Load and Load PPK file
  3. Copy the key that is on the first textarea (public key for pasting...)
  4. In the linux server create ~/.ssh/authorized_keys and paste the key
  5. chmod 700 ~/.ssh
  6. chmod 600 ~/authorized_keys