Going on a few days now I cant SSH into my Ubuntu 16.04.2 LTS server. Everything else is working fine as far as I can tell (it serves a few websites and they're all online no prob). When I try to SSH into it, I get a timeout. I'm using password authentication for now, which I have enabled in sshd_config.

I've tried everything I can think of:

  • Completely reinstalled openssh-server
  • Disabled UFW
  • Flushed iptables and set it to ALLOW all incoming AND outgoing traffic
  • Restarted the server a few times
  • Restarted SSHd a few times and reloaded its config

What else can I try? I'm leaning towards just reinstalling the whole dang server, but that would mean backup and re-install a few websites that it runs as well..

Edit: After reading your comments:

relevant netstat -atnp output:

tcp    0    0**port***    LISTEN    24268/sshd
tcp6    0    0    ::**port**    ::*    LISTEN    24268/sshd

Nothing else is listening on the same port; disabling ufw still doesn't change anything.

ssh command:

ssh user@server -p port

@tatsu: don't know how I could possibly do this wrong, but maybe I'm missing something. I'm using the right username, server address (also tried IP directly) and port.

ssh -vvv output (edited server & local info out for security reasons):

debug1: Reading configuration data **path to user-specific config**
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug2: resolving "**server**" port **port**
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to **server** [**ip address**] port **port**.
debug1: connect to address **ip address** port **port**: Operation timed out
debug1: Connecting to **server** [**ip address**] port **port**.
debug1: connect to address **ip address** port **port**: Operation timed out

I think it is some kind of firewall or something that I'm not aware of in Ubuntu 16.04 LTS. I'm running the same exact config (not just ssh but just about everything) on a Ubuntu 14.04 LTS server and all is smooth there.

Also: I can SSH into all my other servers just fine. I can't SSH into this one using my laptop, a tunnel on one of my other servers, a friend's iMac or my phone on a 4G connection. So... I'm pretty sure the problem is with the server, not my methods or commands.

I have also asked the hosting company that provide the hardware for my server and they can't get it connected on the SSH port either, but are not blocking anything on their end.

Some other things I've tried in the meantime:

  • Changed the SSH port
  • Installed another SSH server package (changed nothing; reinstalled openssh-server)
  • A few more restarts/reboots
  • telnet also times out

Any more ideas/things I can try?

  • 1
    Please give as some output from command netstat -atnp and some error log from server if you have.
    – 2707974
    May 15, 2017 at 9:37
  • also give us your actual ssh command just without the password. I suspect the issue may be there.
    – tatsu
    May 15, 2017 at 10:01
  • please provide output of ssh command with -vvv flag (e.g. ssh -vvv user@host)
    – Yaron
    May 15, 2017 at 10:17

1 Answer 1


Not a satisfying answer at all, but I managed to fix this. I completely uninstalled UFW and then it started working. Must have been a botched install or something. I reinstalled UFW and all is still working fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.