I use ubuntu 16.04 to work, but I needed to format my computer and now I can not access my droplets via SSH only through the Launch Console.

My droplet is with DOKKU and I need access to access the repositories.

I would like to know how I add new SSH keys so I can access my droplets again.

I have already tried to add a new key through the settings / security, but when I try to access my droplet through ssh root @ ipdroplet the Permission denied (publickey) message appears.

Please help me, I’m desperate !!!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

So you still have access to the server which is good.

If you have not, you need to generate some ssh-keys. Once you have done that you need to find your public key.

Which should look something like this example key, If your on windows your key might look different but needs to have this format.

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7kGBwVKF0E54AZl/kGHEn9PgnfbGAbvNMebdSl3YNswRvW0bGdrL8KpW/BQZ76eZV9H5mdMgH6GPxLWhjFTz1jVWtW03s3c2q83xqXsyoXCnHp3NAEggwTHzkzd+OyMSSO2+fSc9ACGfpTvxZGvU5cRAeXkjTg1PQppxBv7lkG8HINYyYiEt6ck70aSUo2Fzck2IQrdTgD62riiUNOGusRGWXPB5thAd/1lNiAxQFu0dssiuDS8BwoU3DaaM0Vm5HH0NUp8Zzxkb7bcbatqs8Yd0F9NEJLtUAyjTxKjbaTcHCQLshtDi+WLMS3kUrJkYPsk/vAyPcLYqiPrvldMjj example@snapshooter.io

You then need to copy this and use the Launch console to access your droplet.

Once in run the following command to edit the authorized_keys file

nano /root/.ssh/authorized_keys

Then append your public key to the authorized keys file. Once this is complete you should be able to log in. This will give you root access, if you need access to a different user account it would be

nano /home/example/.ssh/authorized_keys

Hope this helps

SnapShooter.io - Better DigitalOcean Backups