OS is Ubuntu 12.04 LTS (server; without GUI). The machine is a virtual server running hundreds of miles away in a remote server farm.
I uninstalled postfix and all of it's components (courier, dovecot) and I even stopped sendmail and uninstalled it.
Now there seems to be no program listening on port 25:
netstat -lnptu | grep :25
gives no entry (0 lines). I get the same result with
netstat -anp | grep :25
and also 0 lines result with this command:
fuser -v 25/tcp
From inside the server port 25 is unreachable for telnet:
> telnet localhost 25 Trying ::1... Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection refused
(When I try to connect to port 24 I get exactly the same answer)
Even if I replace 'localhost' by my machines IP-address I am unable to connect to port 25 from inside:
> telnet <IP-address of my server> 25 Trying <IP-address of my server>... telnet: Unable to connect to remote host: Connection refused
... when I do a portscan with http://www.dnstools.ch/port-scanner.html port 25 is reported to be open.
When I try to connect to port 25 on my server with telnet from outside I get this:
> telnet <IP-address of my server> 25 Trying <address>... Connected to <resolved name>. Escape character is '^]'. Connection closed by foreign host.
So I get a connection, but it is closed immediately.
When I try to connect to a closed port I get this:
> telnet <IP-address of my server> 24 Trying <address>... telnet: connect to address <address>: Connection refused telnet: Unable to connect to remote host
I even did try to add some rules to iptables for port 25, but this had absolutely no effect. Port 25 still seems to be open when looking to it from outside, but no program is listening to it.
Question 1: How can this happen?
Question 2: How can I close port 25 under this circumstances?