How to resetup my ssh keys?

February 23, 2018 923 views
Security Deployment Ubuntu 16.04

My ssh keys were all right till I installed let's encrypt. since then I had this error

port 22: Connection timed out

I've tried to reset my password and tried to install my ssh keys by hand and not from the terminal, nothing works! I can't access my root user neither my deploy user. How can I fix that, please?

2 Answers

try creating a new user with sudo privileges - install your key(s) to that user and attempt a login

  • adduser SOMENAME

  • usermod -aG sudo SOMENAME

  • vi /home/SOMENAME/.ssh/id_rsa.pub paste your public key

  • cp -v /home/SOMENAME/.ssh/id_rsa /home/SOMENAME/.ssh/authorized_keys

  • chmod 600 /home/SOMENAME/.ssh/authorized_keys

Replace SOMENAME with a name of your choice.

Ensure your KeyAgent is running on your working computer

  • eval `ssh-agent`

  • ssh-add ~/.ssh/id_rsa

I am assuming your key name is id_rsa and that you are working on a linux of macOS system

then try and ssh to your droplet with the new user using the IP of your droplet

  • ssh SOMENAME@XXX.XXX.XXX.XXX
  • But I can't paste anything in the digital ocean terminal so I wasn't able to paste the ssh keys, and I wrote the ssh key manually but I wasn't able to save the file!!

    • hmmmm wow, that would be a long string.

      Can you access it via FTP or anything? or can you scp the file to the droplet from another server using the console?

      • I don't know, this is my first app ever and my experience with ssh started with it. Do ypu think there is any way to reset things the way they were?

        • Only if you have taken a backup or snapshot or you manually reverse all changes.

          Can you ping your droplet's IP address?

Can you access it via the DigitalOcean terminal?

Have another answer? Share your knowledge.