Need help getting my ssh keys to work on a digital

2019-05-23 00:52发布

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 root@107.170.209.13
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.
root@107.170.209.13's password: 
Permission denied, please try again.
root@107.170.209.13's password: 
Permission denied, please try again.

4条回答
Deceive 欺骗
2楼-- · 2019-05-23 01:29

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

查看更多
一纸荒年 Trace。
3楼-- · 2019-05-23 01:31

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

查看更多
放我归山
4楼-- · 2019-05-23 01:49

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).

查看更多
【Aperson】
5楼-- · 2019-05-23 01:52

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

查看更多
登录 后发表回答