after I rebooted my server, I can no longer ssh into it. I am running headless Ubuntu 20.04.5
After investigating the problem, I've noticed, that all ports on my server appear to be closed (using an open port checker like yougetsignal). I tested that with all ports previously open.
However, sudo netstat -tulpn | grep LISTEN
returns that my ports are open. Example for port 22:
tcp6 0 0 :::22 :::* LISTEN 362/sshd: /usr/sbin
telnet localhost 22
also results in a timeout.
My next assumption was that somehow iptables rules were overwritten, so I ran iptables -S | grep '22'
, still using port 22 as an example. It resulted in:
-A INPUT -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 22 -m conntrack --ctstate ESTABLISHED -j ACCEPT
Also, ufw is not installed, nor any other firewall service that I know of.
I am somewhat lost right now, since I can't locate the problem, let alone solve it.
Any help is greatly appreciated.
Update:
nnmap localhost
has the following output:
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000012s latency).
Other addresses for localhost (not scanned): ::1
Not shown: 985 closed ports
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
25/tcp open smtp
53/tcp open domain
80/tcp open http
110/tcp open pop3
143/tcp open imap
443/tcp open https
465/tcp open smtps
587/tcp open submission
993/tcp open imaps
995/tcp open pop3s
3000/tcp open ppp
3306/tcp open mysql
8090/tcp open opsmessaging
However, using nmap to scan from another system returns:
Host is up (0.0011s latency).
Not shown: 995 filtered ports
PORT STATE SERVICE
53/tcp open domain
143/tcp open imap
993/tcp open imaps
995/tcp open pop3s
40193/tcp closed unknown
So while it appears that the ports are open, they are not reachable from the outside.