1

Noob here. I removed all the files from my /Users/fakename/.shh folder. The result is that now I can't git clone a repository from beanstalk. When I try I get the error Failed to add the host to the list of known hosts Permission denied (public key). I am also having problems doing a SSH login into an EC2 instance on Amazon Web Services.

What would be the steps to get things back to normal?

EDIT 1

I am currently trying to generate a new rsa key pair, but getting the following:

open /Users/fake-name/.ssh/id_rsa failed: Permission denied.
Saving the key failed: /Users/fake-name/.ssh/id_rsa.
Eric Brotto
  • 53,471
  • 32
  • 129
  • 174

1 Answers1

2

You can't recover the already lost keys.

Change the ownership of the ~/.ssh directory to your user

sudo chown fakename:fakename .ssh

and generate a new pair of rsa keys using ssh-keygen

Regarding recovering your ec2 instance, check out the answers on this if your Users folders is EBS backed, else if you are the only user, you are screwed

Community
  • 1
  • 1
Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186