Question

I cannot connect (ssh) to my droplet.

I all of a sudden cannot connect to my droplet via ssh through Mac terminal. I ran the following:

ssh -vv root@my_ip

And get the following:

MacBook-Pro:~ my_name$ ssh -vv root@my_ip OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 debug1: Reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: Applying options for * debug1: /etc/ssh_config line 102: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to my_ip [my_ip] port 22. debug1: Connection established. debug1: identity file /Users/my_name/.ssh/id_rsa type 1 debug1: identity file /Users/my_name/.ssh/id_rsa-cert type -1 debug1: identity file /Users/my_name/.ssh/id_dsa type -1 debug1: identity file /Users/my_name/.ssh/id_dsa-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.2 ssh_exchange_identification: read: Connection reset by peer

Any ideas?

Subscribe
Share

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

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.

@doctormcluvin

How was the Droplet setup? – A one-click image, manually, etc?

Are you using a firewall such as ufw or an IPS such as fail2ban?

If so, you may have been blocked in which case you’d need to login using console and check the logs, and/or disable the firewall or service to see if that’ll allow you back in.

You can access DigitalOcean’s console by logging in to the DigitalOcean Control Panel, clicking on the name of the Droplet, then from the left side menu, click on Access. You’ll see a big blue button that says Launch Console. You’ll need your root password to login.

ufw can be disabled using ufw disable. Once disabled, I normally recommend resetting the rule set and starting fresh. If you’re able to login using Terminal once ufw is disabled, do so, and then run the following (you should be able to copy and paste to Terminal):

ufw reset

Followed by:

ufw default deny incoming \
&& ufw default allow outgoing \
&& ufw allow 22/tcp \
&& ufw allow 80/tcp \
&& ufw allow 443/tcp

Followed by:

ufw enable

The above will reset ufw to a barebones configuration, setup default policies, and then only allow a connection on ports 22, 80, and 443.