Usually I just use root-password to setup a server for the first time, but this time I decided to try SSH key upon creating the server – instead of adding it afterwards. That was a bad move.
No supported authentication methods available (server sent public key)
I didn’t find any root-password. Probably because Digital Ocean don’t tell you that if you select SSH-key.
When trying to login, I got the error «No supported authentication methods available (server sent public key)».
Solution:
- Reset root password on the droplet, in Digital Ocean.
- The password will be sent to you by mail.
- Use Digital Ocean server console to login as root.
I tried to add the SSH key from the console, but I could not paste it, because the console somehow was stuck in CAPS-mode or something weird. If I turned on CAPS, the console input was lowercase – but all was uppercase when pasting something.
- Type $ vi /etc/ssh/sshdconfig
- Change PasswordAuthentication from “no” to “yes” and save the file
- $ sudo systemctl restart sshd OR $ sudo service sshd restart
- Now you should be able to login with putty
Credits: https://www.digitalocean.com/community/questions/problem-with-copy-paste-into-digitalocean-droplet-s-console-window
Console stuck in CAPS
I didn’t really find a good solution for this. Google say it can be solved by something like:
- Restart server
- SHIFT + CAPS
- or type setleds -D +caps
Source: https://www.digitalocean.com/community/questions/console-stuck-in-caps-lock-mode
Add the SSH key (on Windows)
There is a lot of guides for this on Google, so I’m just writing the short version for myself in the future.
- Generate SSH key with PuTTYgen
- Save the private/public file
- Open pageant and add the file there.
If you don’t have a ssh file, I think it can be added to your .ssh folder in C:\Users\<username>\.ssh, named id_rsa and id_rsa.pub. That file works for me without pageant, but not other files.