0

I am running this command:

telnet 87.106.xxx.xxx 25

And it says

Trying 87.106.xxx.xxx...
telnet: Unable to connect to remote host: Connection refused

But telnet localhost is running properly.

Then I ran this command

sudo netstat -plntu

and it gave me:

tcp   0   0 127.0.0.1:25    0.0.0.0:*     LISTEN      9518/sendmail: MTA:

But the problem is I don't have Sendmail. I am using postfix.

I tried to uninstall sendmail with apt-get purge sendmail But it gives error:

Package sendmail is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I am looking for a way so that the post 25 should be used by Postfix.

Kamran
  • 99
  • 2
  • 8
  • Try to restart postfix AND look some lines produced from maillog. – masegaloeh Jul 24 '14 at 14:31
  • @masegaloeh Yes I restarted and maillog says that: postfix/master[11258]: terminating on signal 15 postfix/master[11591]: daemon started -- version 2.9.6, configuration /etc/postfix – Kamran Jul 24 '14 at 14:34
  • 1
    What happens if you try `telnet 127.0.0.1 25`? – Massimo Jul 24 '14 at 14:40
  • @Massimo The same error: Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection refused – Kamran Jul 24 '14 at 14:43
  • Please do a `which sendmail` to look if there's really no binary. – sebix Jul 24 '14 at 14:50
  • Looks like it's keeping the port open but it's not really accepting connections, then... – Massimo Jul 24 '14 at 14:50
  • @Massimo "which sendmail" gives me-> /usr/sbin/sendmail. – Kamran Jul 24 '14 at 14:53
  • Please post the output of `postconf -n`, so we can see if you have anything misconfigured. And also the output of `sudo iptables -t nat -L`, to see if anything is blocked by your server internally – sebix Jul 24 '14 at 15:54

3 Answers3

1

sendmail is still installed*, the package is called sendmail-bin, sendmail-base, opensmtpd etc.

apt-get purge sendmail-bin sendmail-base opensmtpd

Found using the package search on packages.ubuntu.com: Content search for sendmail

*) Your which sendmail gave as output /usr/sbin/sendmail. which returns the path of an executable, which would be executed if typed on the command line. This means, the sendmail binary was still existing.

sebix
  • 4,175
  • 2
  • 25
  • 45
  • Thanks for the Answer, I run this command and send mail is not removed. But I when I run {which sendmail} I still can see {/usr/sbin/sendmail} – Kamran Jul 24 '14 at 15:05
  • Very interesting, let's see what's the output of this one: `dpkg -l | grep -E 'dovecot|opensmtpd'` It displays only installed packages. – sebix Jul 24 '14 at 15:31
  • @Kami, looks like in this case, that binary is sendmail binary [from postfix](http://www.postfix.org/sendmail.1.html). See http://serverfault.com/questions/244263/is-postfix-the-same-thing-as-sendmail – masegaloeh Jul 24 '14 at 15:41
  • @masegaloeh Oh, I overlooked that! So, that's probably not the solution. – sebix Jul 24 '14 at 15:55
  • @masegaloeh :( I have uninstalled using the commands provided by sebix. Now what I have to do. By the way my Postfix is now running properly and sending emails as desired. And Telnet command is also running... – Kamran Jul 24 '14 at 15:59
  • @Kami Congratulation, you have nothing to do :)). Before you do sebix solution, the sendmail binary is independent program from postfix. After you uninstall it, postfix install its own implementation of sendmail binary for compatibility reason. See the two links given in my comment above. – masegaloeh Jul 24 '14 at 16:02
1

Step 1:

apt-get purge sendmail*

This will remove all its files and configurations.

Step 2:

kill 9518 # or 
killall sendmail

This should kill the sendmail process that's using your port.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
Ashley
  • 11
  • 1
0

seems like your postfix is just listening it on localhost, so all you gotta do is change inet_interfaces from localhost to all.

[root@wcmisdlin02 ~]# grep ^inet_interfaces /etc/postfix/main.cf 
inet_interfaces = all
[root@wcmisdlin02 ~]# 

don't forget to restart postfix after that.

* UPDATE *

It looks like you have you're running sendmail and not postfix, so you probably have something like this inside of your sendmail.mc file:

# grep -E '^DAEMON_OPTIONS.*Addr' /etc/mail/sendmail.mc 
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
# 

you need to remove Addr part, rebuild your sendmail.cf and restart sendmail.

alexus
  • 12,342
  • 27
  • 115
  • 173
  • Yes inet_interfaces is set to all already. "inet_interfaces = all". I checked that I cannot access it with any port. e.g. telnet 87.106.xxx.xxx 33, gave me same error. I checked different number of ports but its still give me the same error. – Kamran Jul 24 '14 at 14:14
  • if it's already set to `all` from `localhost` than I'm guessing you didn't restart your postfix yet, as that's the only configuration change is needed in order to start listening on all interfaces. – alexus Jul 24 '14 at 14:37
  • I even started my system but still its the same. – Kamran Jul 24 '14 at 14:39
  • @Kami, I just updated my answer with `sendmail` as well, as it seems like you're running `sendmail` and not `postfix`. – alexus Jul 24 '14 at 14:45
  • Yes This file exist in my system. How Can I remove sendmail. Because apt-get purge sendmail says that "Package sendmail is not installed, so not removed". I don' want to use this stupid Sendmail :( – Kamran Jul 24 '14 at 14:51