Deleted RSA Private KEYS

Juliana Mei
2 min readNov 7, 2017

Here’s a lesson I’ll never forget. It’s simple — do not delete your id_rsa.pub and especially do not delete your private id_rsa key! That’s how your server, your github, your everything recognizes that the machine you’re working on IS YOU.

I was in the middle of a project and I was desperate to deploy. I was working with MongoDB and for some reason, it wasn’t letting me update or query the database, even though I was admin! However, my collaborate was allowed. I kept getting an SSL error. I started googling why I was getting this error. I followed a tutorial blindly and long story short, I deleted my machines private key. Actually, I ‘edited’ it to match another key. Don’t do that. If you’re going to do that, keep a backup of the original key.

Suddenly, I can’t ssh into my server anymore.

I couldn’t upload to github automatically anymore.

It forced me to login every time I wanted to commit/push. It was a major inconvenience. But I can’t let that stop the project, we had to keep going. In the end, the SSL error was simply because I needed to update my machines SSL.

I asked for help right away. The DIR, Eric, helped me regenerate new keys. Then, we need to set the new keys into myAmazon lightsail server. When we got to the keys in the server, Amazon used a separate terminal which didn’t allow us to copy and paste. Typing it in wasn’t an option. It’s a long key and that allowed for too much human error.

Finally, after a long weekend of coding and suffering through repeated typing of my github credentials, Paul solves the whole thing in 15 minutes. He shared that he also did something dumb like me and deleted his keys. When we got to Amazon’s lightsail terminal, he triple clicked (middle button on mouses) to paste into the terminal. Why doesn’t amazon instruct us? Why doesn’t google have an answer for that? I should post a stack overflow question and answer it myself.

Now that my server recognizes me, he helped me set up the keys in my github. He went to my github settings, deleted the old SSH key and regular pasted it there. Just like that, problem solved.

I’ll never forget my lesson.

--

--

Juliana Mei

Software Engineer — Blockchain, Cybersecurity, and Commercial Space