Timothy Lombard
Timothy Lombard

Reputation: 967

Need help getting my ssh keys to work on a digital ocean droplet

When creating the new droplet I check the SSH option and paste my public key (that works fine on my AWS) Droplet but unable to login to new droplet. Both instances are using ubuntu. From reading the documentation, I understand that if SSH keys are provide at the creation of an instance, no email with root password is sent. Not sure why I am being prompted for password. Assistance would be appreciated.

here is the session on my attempt to login:

TLOMBARD-M-T8T8:.ssh tlombard$ ssh [email protected]
The authenticity of host '107.170.209.13 (107.170.209.13)' can't be established.
ECDSA key fingerprint is SHA256:CsusP0faav9SqEfSXpXpMjeEEp2GXrT77OT35x3TJco.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '107.170.209.13' (ECDSA) to the list of known hosts.
[email protected]'s password: 
Permission denied, please try again.
[email protected]'s password: 
Permission denied, please try again.

Upvotes: 3

Views: 3654

Answers (4)

Nahid
Nahid

Reputation: 3045

Run: sudo vim /etc/ssh/sshd_config

And Change following two settings to yes

  1. PermitRootLogin yes

  2. PasswordAuthentication yes

Now setup root passowd: sudo passwd root

Restart SSH: sudo service sshd restart

Upvotes: 3

Edgencio Da Calista
Edgencio Da Calista

Reputation: 515

First ensure that you are typing your password correctly, then update your sshd_config file enabling Password authentication.

On your ubuntu cli execute: sudo nano /etc/ssh/sshd_config

Then update Password authentication line from PasswordAuthontication: no to PasswordAuthentication:yes

Restart your ssh service executing sudo service ssh restart

Upvotes: 4

Katie
Katie

Reputation: 2693

You need to check your SSH configuration on your Droplet.

  • Log in via console (on the Digital Ocean website)
  • su (to become root)
  • edit the file /etc/ssh/sshd_config
  • Search for the setting PermitRootLogin and set it to:

    PermitRootLogin: without-password

  • Also check the PasswordAuthentication and make sure it is set to:

    PasswordAuthentication: no

The PermitRootLogin ensures that SSH is expecting a keyed login for root. I think that is all you need, but it doesn't hurt to set the PasswordAuthentication as well, which sets keyed only for all users.

Be sure to run

systemctl reload sshd 

This will restart SSH with the new settings, for ubuntu 16.04. (I think for 14.04 it was service ssh restart).

Upvotes: 3

fubar
fubar

Reputation: 17378

You can reset the root password via the droplet control panel. Then you can SSH into the droplet and add your SSH key.

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2

Upvotes: 1

Related Questions