Cant ssh into server

October 11, 2016 112 views
Server Optimization Ubuntu 16.04

I setup a new droplet about 36hrs ago and followed the tutorials here on DO to create the ssh keys for my local computer. I logged out and then back in after to make sure it worked and I must have logged out and back in a few times after that.

Today however when I run 'ssh myusername@myserverip' nothing happens, the cursor moves to a new line and just sites there, no error message is given and Im not prompted to do anything else. Ive tried new terminals as well as restarting and still the same. I can see the .ssh folder in my main user directory on my computer (ubuntu) and in that there are the following files


these all seem to have the keys in too.

What is the problem here?

  • Hi,
    Are you sure your Droplet is up and could be accessed via Internet? Most easiest way to check it is to ping your Droplet via IP (from your local machine). If Droplet doesn't answer to ping, it means that Droplet is down or for some reason have network disabled.
    In case it is ping is successful, you can try restarting whole Droplet or only restarting SSH via Console in Control Panel.

    Make sure you didn't made any other change that can break SSH connection, for example enabling firewall

  • There are a few things I would recommend trying in order to start troubleshooting this issue.

    1.) add a -v to your ssh command. This will provide more verbose output and might point to the issue.

    2.) Use ping/traceroute and make sure you can reach your server. This will help rule out a networking issue.

    3.) If you have a password set for your user as well, try logging in via the console in the control panel.

    Let us know what you find.

  • thanks, this is the -v out put

    ssh david@ -v
    OpenSSH7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
    debug1: Reading configuration data /etc/ssh/ssh
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug1: Connecting to [] port 22.

    (edit - I should add that after that last line it just hangs and nothing else happens)

    I can ping the server just fine.

    I forgot to mention that I can access the server just fine via the console from my account.

    I had skipped the ufw setup after initializing the droplet but I went straight to this tutorial which did instruct to run 'ufw delete allow 8080' towards the end before enabling 'Nginx Full'

    if you see the last comment there I am actually stuck there too with a 502 bad gateway problem, not sure if this is related though...

    Django is a powerful web framework that can help you get your Python application or website off the ground. Django includes a simplified development server for testing your code locally, but for anything even slightly production related, a more secure and powerful web server...
  • Not much in the -v output to help so here are a couple more things to try.

    1.) Disable UFW to make sure it's not the issue. sudo ufw stop (if this solves the problem don't forget to come back and fix the configuration since a firewall that isn't running doesn't do any good :) )
    2.) Try restarting your ssh service from the console service ssh restart

  • thanks, that worked, I did both so not sure which it was that did it, I think maybe the ssh restart as I think recall disabling ufw before at some point.

  • OK so it is/was ufw, just re-enabled it, logged out and then exact same problem again when I try get back in from local terminal, disabled it again from console and can login again from terminal. Im going to look closer at what I had allowed and disallowed before with ufw now...

  • and this is its status

    sudo ufw status
    Status: active

    To Action From

    Nginx Full ALLOW Anywhere

    Nginx Full (v6) ALLOW Anywhere (v6)

Be the first one to answer this question.