Question

Can't SSH into my newly created droplet

Hello Team,

I have created 3 droplets of Ubuntu 18.04, now when I am trying to ssh into these droplets from my Ubuntu host machine getting below error :

****root@UbuntuServer-VirtualBox:~# ssh root@139.59.7.4
The authenticity of host '139.59.7.4 (139.59.7.4)' can't be established.
ECDSA key fingerprint is SHA256:bHqoYKq4Pr6uY7eIXE4hqvNLVhO9fszXZRVqiBUHgAc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '139.59.7.4' (ECDSA) to the list of known hosts.
root@139.59.7.4: Permission denied (publickey).**
**
-> Also adding the verbose output :

root@UbuntuServer-VirtualBox:~# ssh -v root@139.59.7.4
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 139.59.7.4 [139.59.7.4] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 139.59.7.4:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:bHqoYKq4Pr6uY7eIXE4hqvNLVhO9fszXZRVqiBUHgAc
debug1: Host '139.59.7.4' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: No more authentication methods to try.
root@139.59.7.4: Permission denied (publickey).

Any idea why it is happening although I have already added my HOST public key into the droplets authentication policy as described in the Droplet documentation.

Regards Chinkleet


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

It looks like ssh client cannot match private key with the public key presented by droplet’s ssh server. Did you name your key pair during creating it (e.g. ssh-keygen -f specific_key_name) ? Check your /root/.ssh/ directory. If yes, you should provide full path to the private key, e.g.

ssh -i /root/.ssh/specific_key_name root@139.59.7.4

Hi there @chinkleet,

As far as I can see from the output it looks like that you might not have added the SSH key from your Virtual Box Server to your Droplet.

To check that I would recommend connecting to your Virtual Box Server via SSH, and then running:

  1. cat ~/.ssh/id_rsa.pub

After that make sure that the SSH key matches the one that you’ve added to your account.

If this still does not work, I would recommend adding 3 -v for more information:

  1. ssh -vvv root@your_ip_address

Let me know how it goes! Regards, Bobby