3

I am fairly new to server administration and completely new to mail server administration.

Someone else installed my mail server and I need to a) determine which program it is and b) check mail sending logs. The server is a Digital Ocean droplet (again, someone set it up for me, they are not available for contact now). It is a centOS distro.

How do I determine which mail server is running on my system?

Oliver Williams
  • 286
  • 1
  • 3
  • 13
  • NOTE: after posting this I thought to try `which sendmail` which in turn returned `/usr/sbin/sendmail` which lets me know but am letting the question remain as this method is presumptive of knowing or guessing the program anyway. I know there are many mail programs out there; I'll leave the question stand but happy to delete it if that is requested. – Oliver Williams Jan 09 '17 at 11:26
  • the binary `sendmail` is provided by nearly every MTA. It is just expected to be there, that doesn't tell you which package it belongs to. Just run `yum provides /usr/sbin/sendmail` and see the output. The installed package is marked as `Repo: installed`. – Gerald Schneider Jan 09 '17 at 11:32
  • @GeraldSchneider, the `yum provides..` command did not work, as I needed to go through the accepted answer's steps to get `yum provides /usr/sbin/exim` - `yum provides /usr/sbin/sendmail` just resulted in "No matches found" – Oliver Williams Jan 09 '17 at 11:49

2 Answers2

7

netstat will tell you the binary that is listening on the tcp ports.

$ netstat -nlp |grep :25
tcp        0      0 ::1:25                      :::*                        LISTEN      1782/master

ps tells you the exact path of the binary:

$ ps -Af |grep 1782
 root      1782     1  0  2016 ?        00:00:51 /usr/libexec/postfix/master

yum provides will tell you wich package it belongs to.

$ yum provides /usr/libexec/postfix/master
2:postfix-2.6.6-6.el6_7.1.x86_64 : Postfix Mail Transport Agent
Repo        : installed
Matched from:
Other       : Provides-match: /usr/libexec/postfix/master

Look for Repo: installed in the result.

In this case, it is postfix

Gerald Schneider
  • 23,274
  • 8
  • 57
  • 89
  • This got me to the process as you said, I then used `ps` to identify `/usr/sbin/exim`. Then the `yum provides` which gave me: `exim-4.87-6.cp1156.x86_64 : exim mail transport agent Repo : installed` – Oliver Williams Jan 09 '17 at 11:47
0

Red Hat Enterprise Linux (RHEL) and derivates such as CentOS allow an admin to select their preferred mailserver, with Postfix and Sendmail as the primary choices.
The command alternatives --display mta will display which Mail Transport Agent (SMTP mailserver) is installed and enabled as your default.

For a server using Sendmail that will display something like:

alternatives --display mta
mta - status is manual.
 link currently points to /usr/sbin/sendmail.sendmail
/usr/sbin/sendmail.sendmail - priority 90
 slave mta-pam: /etc/pam.d/smtp.sendmail
 slave mta-mailq: /usr/bin/mailq.sendmail
 slave mta-newaliases: /usr/bin/newaliases.sendmail
 slave mta-rmail: /usr/bin/rmail.sendmail
 slave mta-sendmail: /usr/lib/sendmail.sendmail
 slave mta-mailqman: /usr/share/man/man1/mailq.sendmail.1.gz
 slave mta-newaliasesman: /usr/share/man/man1/newaliases.sendmail.1.gz
 slave mta-aliasesman: /usr/share/man/man5/aliases.sendmail.5.gz
 slave mta-sendmailman: /usr/share/man/man8/sendmail.sendmail.8.gz
Current `best' version is /usr/sbin/sendmail.sendmail.

For Postfix:

alternatives --display mta
mta - status is auto.
 link currently points to /usr/sbin/sendmail.postfix
/usr/sbin/sendmail.postfix - priority 30
 slave mta-pam: /etc/pam.d/smtp.postfix
 slave mta-mailq: /usr/bin/mailq.postfix
 slave mta-newaliases: /usr/bin/newaliases.postfix
 slave mta-rmail: /usr/bin/rmail.postfix
 slave mta-sendmail: /usr/lib/sendmail.postfix
 slave mta-mailqman: /usr/share/man/man1/mailq.postfix.1.gz
 slave mta-newaliasesman: /usr/share/man/man1/newaliases.postfix.1.gz
 slave mta-aliasesman: /usr/share/man/man5/aliases.postfix.5.gz
 slave mta-sendmailman: /usr/share/man/man1/sendmail.postfix.1.gz
Current `best' version is /usr/sbin/sendmail.postfix.

By convention log files are stored in /var/log and mailservers and syslog are typically configured to log to the file with the obvious name /var/log/maillog.

HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • in my case it is exim. I do not know why I have this particular software installed. FYI running `alternatives --display mta` simply returned empty in my case. – Oliver Williams Jan 09 '17 at 11:52