Can't connect with ssh with Ubuntu

February 21, 2016 3.9k views
Linux Commands Linux Basics DigitalOcean

ssh root@107.170.80.75

Connection closed by 107.170.80.75

ssh -vvvv root@107.170.80.75

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 107.170.80.75 [107.170.80.75] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/kedinn/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/kedinn/.ssh/id_rsa type -1
debug1: identity file /home/kedinn/.ssh/id_rsa-cert type -1
debug1: identity file /home/kedinn/.ssh/id_dsa type -1
debug1: identity file /home/kedinn/.ssh/id_dsa-cert type -1
debug1: identity file /home/kedinn/.ssh/id_ecdsa type -1
debug1: identity file /home/kedinn/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/kedinn/.ssh/id_ed25519 type -1
debug1: identity file /home/kedinn/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH_6.6.1* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "107.170.80.75" from file "/home/kedinn/.ssh/known_hosts"
debug3: load_hostkeys: loaded 0 keys
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 107.170.80.75

4 comments
2 Answers

This question was answered by @rbeard:

I had this problem as well and followed this here https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets

You need to add a user while logged in as root. You can always login in as root from your DO account using the console there. To log in from your local terminal then ssh to the newuser account which needs to have sudo privileges, e.g. using sudo adduser <username> sudo.

You can't access root directly from the terminal once ssh keys have been enabled. Always go via a user account and sudo to make changes to root.

View the original comment

by Etel Sverdlov
This guide is for Mac OS X and Linux users. Learn how to use SSH Keys with DigitalOcean Droplets.

Ok, the fix I suggested above no longer works. I am trying to set up a new droplet. Normally, one can login as root and then copy the SSH key from the local machine into authorized_keys, however this is no longer working for me. So I am stuck, I can neither login as root nor as a user, except though the DO web interface, but then I can't paste in the SSH key. The interface is forcing me to use an SSH key that I use for another droplet and it all works fine for the other droplet. But it does not work for the new droplet I'm trying to set up. So what's wrong?

Have another answer? Share your knowledge.