I have a remote dedicated server. It is running the newest Debian stable. Having had it running for quite a while, I finally decided to reboot it so it could run on a newer kernel. However, since rebooting, I have been unable to connect via ports 22, 80 and 443. The server responds to ping. SSH error message: Connection timed out.

Fortunately, the data centre where it is located has a rescue system, that I have used - albeit in vain - to fix this problem. After looking through syslog and auth.log, it is clear that sshd is started by systemd correctly, and appears to be listening on port 22 as expected.

Mar  3 09:28:48 server sshd[975]: Server listening on port 22.
Mar  3 09:33:55 server sshd[975]: Received signal 15; terminating.

Yet somehow, I am unable to access it remotely. Most issues I look for of this sort are about sshd not starting at all, but that does not appear to be the case. I am able to access the rescue system without problem remotely, so the issue is not on my end. I wonder if there are perhaps some firewall services, that I am unaware of that might have been installed. Or some sshd settings to be wary of.

For the record, here is my sshd_config with all comments removed:

Port 22

Protocol 2

HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key

SyslogFacility AUTH
LogLevel INFO

LoginGraceTime 120

PermitRootLogin no
StrictModes yes

PubkeyAuthentication yes
IgnoreRhosts yes

HostbasedAuthentication no

PermitEmptyPasswords no

ChallengeResponseAuthentication no

PasswordAuthentication no

PrintMotd no
PrintLastLog yes
TCPKeepAlive yes

AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

UsePAM yes
UseDNS no

Since it also appears to be a problem for port 80 and 443, I wonder whether it is a more general problem, but at least if I could get SSH to work, I would be able to perhaps fix those problems as well.



sudo ufw allow 22

See also: https://askubuntu.com/questions/30080/how-to-solve-connection-refused-errors-in-ssh-connection

  • You nailed it with the ufw suggestion. It was indeed that blocking the ports. Using the KVM suggestion in comment to my question, I was able to permit port 22. And now I can access it, permitting the other two blocked ports. – Svip Mar 3 at 10:15
  • It's weird a reboot enabled a firewall. I guess it's down to Debian peculiarities. – Artem S. Tashkinov Mar 3 at 18:10

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.