Config mta – howto

Centos has a neat application for switching between alternative software packages, called alternatives.

Few days ago I noticed that one server doesn’t send logwatch email. I wanted to see what was the reason and here are the few tips you can check before you dig inside logwatch settings.

First, check /etc/aliases and root email inside

# nano /etc/aliases

at the end, check next lines:

# Person who should get root's mail
root:           blabla@domain.tld

After you save aliases, enter command

# newaliases

This command rebuilds the random access data base for the mail aliases file /etc/aliases. It must be run each time this file is changed in order for the change to take effect. This would be enough to receive all email directed to root, but in case you still don’t get root emails, check mta with:

# alternatives --display mta

This will show you something like

[root@s1 ~]# 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
/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.sendmail.

We use postfix so we should change this with

[root@s1 ~]# alternatives --config mta
 
There are 2 programs which provide 'mta'.
 
  Selection    Command
-----------------------------------------------
*+ 1           /usr/sbin/sendmail.sendmail
   2           /usr/sbin/sendmail.postfix
 
Enter to keep the current selection[+], or type selection number:

Enter 2 and press Enter. Then check your mta with

[root@s1 ~]# alternatives --display mta
mta - status is manual.
 link currently points to /usr/sbin/sendmail.postfix

That’s it… Now if your logwatch is configured properly you should receive root emails…

Leave a Reply

Your email address will not be published. Required fields are marked *