acamp120
By:
acamp120

SSH Error: Connection refused after 'sudo reboot'

July 9, 2015 13.3k views
Networking DigitalOcean Ubuntu

I am running a MySQL server on Ubuntu 14.04 LTS (vmlinuz-3.13.0-52-generic). I had run the following via SSH, and, after a reboot of the Droplet, I can no longer connect via SSH:

sudo apt-get update
sudo apt-get upgrade
Saw a message about restart required
sudo reboot

When I SSH:

~ $ ssh xxxxxxxxx@###.###.###.###
ssh: connect to host ###.###.###.### port 22: Connection refused

My /etc/ssh/sshd_config file is set to receive connections on port 22, I have not changed this.

Steps I've taken:

I tried to power cycle my Droplet via the Digitalocean control panel and am still receiving the same error when I attempt to SSH into my Droplet.

I have attempted to gain console access via the Digitalocean control panel, but I am not receiving a command prompt, only the following (it just sits there):

Ubuntu 14.04.2 LTS hostname tty1
hostname login: Cloud-init v. 0.7.5 running 'modules:final' at Thu 09 Jul 2015 18:09:29 +0000. Up 5.85 seconds
Cloud-init v. 0.7.5 finished at Thu 09 Jul 2015 18:09:29 +0000. Datasource DataSourceDigitalOcean. Up 5.93 seconds

Any ideas?

1 comment
  • @acamp120 When attempting to login remotely, try using:

    ssh -v [username]@[ipaddress] ....
    
    ssh -vv [username]@[ipaddress] ....
    
    ssh -vvv [username]@[ipaddress] ....
    

    What this does, essentially, is increase the verbosity of what is output when attempting to connect via SSH. This will give you an idea of what's going on during the back and forth exchange. Start with -v, then -vv and finally -vvv (as -vvv will throw about a page and a half of output at you).

    You can also check /root/.ssh/knownhosts (on your local machine - if using Linux). You can clean that specific file out and then attempt to reconnect. It'll ask you to confirm that you'd like to add the host you're connecting to (to the knownhosts file). I've had plenty of instances which required this over the years as small changes (regeneration of server keys, for example), can invalidate your connection (though you'll normally receive a message in such a case).

    Beyond that, was a firewall active (i.e. iptables or UFW)? If so, and your IP wasn't whitelisted, it's possible your connection is being blocked. You should still be able to get in through console though.

2 Answers

This question was answered by @jtittle:

@acamp120 When attempting to login remotely, try using:

ssh -v [username]@[ipaddress] ....

ssh -vv [username]@[ipaddress] ....

ssh -vvv [username]@[ipaddress] ....

What this does, essentially, is increase the verbosity of what is output when attempting to connect via SSH. This will give you an idea of what's going on during the back and forth exchange. Start with -v, then -vv and finally -vvv (as -vvv will throw about a page and a half of output at you).

You can also check /root/.ssh/knownhosts (on your local machine - if using Linux). You can clean that specific file out and then attempt to reconnect. It'll ask you to confirm that you'd like to add the host you're connecting to (to the knownhosts file). I've had plenty of instances which required this over the years as small changes (regeneration of server keys, for example), can invalidate your connection (though you'll normally receive a message in such a case).

Beyond that, was a firewall active (i.e. iptables or UFW)? If so, and your IP wasn't whitelisted, it's possible your connection is being blocked. You should still be able to get in through console though.

View the original comment

I wound up here with the same problem, minus the console issue. This SO answer may fix the ssh problem for those in the same boat. "By default, the SSH server denies password-based login for root.", so you'll have to change that to suit your needs.

Have another answer? Share your knowledge.