How to Identify Running MTA (Postfix/Exim) and Locate Configuration Files in Linux


2 views

To determine which mail server is running on your Linux system, use these commands:

# Method 1: Check running processes
ps aux | grep -E 'postfix|exim|sendmail|qmail'

# Method 2: Check installed packages
dpkg -l | grep -E 'postfix|exim'  # For Debian/Ubuntu
rpm -qa | grep -E 'postfix|exim'  # For RHEL/CentOS

# Method 3: Check service status
systemctl list-units --type=service | grep -E 'postfix|exim'

For Postfix, the main configuration directory is typically:

/etc/postfix/

The master.cf file might be located in:

/etc/postfix/master.cf

If you can't find it there, try searching the entire system:

sudo find / -name "master.cf" 2>/dev/null

Different MTAs store their configurations in different locations:

# Postfix
/etc/postfix/main.cf
/etc/postfix/master.cf

# Exim
/etc/exim4/exim4.conf
/etc/exim4/update-exim4.conf.conf

# Sendmail
/etc/mail/sendmail.cf
/etc/mail/submit.cf

To check if your MTA is actually running:

# For Postfix
sudo postfix status
sudo systemctl status postfix

# For Exim
sudo exim -bP
sudo systemctl status exim4

For CPPOP (Common PHP POP3), you'll typically need to modify its configuration file. Common locations include:

/etc/cppop/config.ini
/usr/local/cppop/conf/settings.php

Example configuration snippet for authentication:

[mailserver]
host = mail.yourdomain.com
port = 110
timeout = 30
ssl = false

[authentication]
username = "user@domain.com"
password = "securepassword"

If you're having trouble locating files or services:

# Check which process is listening on SMTP ports (25, 587)
sudo netstat -tulnp | grep -E ':25|:587'

# Check mail logs for clues
sudo tail -f /var/log/mail.log
sudo journalctl -u postfix -f

To determine which MTA (Mail Transfer Agent) is running on your Linux system, you can use several commands:

# Method 1: Check running processes
ps aux | grep -E 'postfix|exim|sendmail|qmail'

# Method 2: Check installed packages
dpkg -l | grep -E 'postfix|exim|sendmail|qmail'  # For Debian/Ubuntu
rpm -qa | grep -E 'postfix|exim|sendmail|qmail'   # For RHEL/CentOS

# Method 3: Check listening ports
netstat -tulnp | grep -E '25|587'

If Postfix is installed but you can't find its configuration directory:

# Find Postfix installation path
postconf -n | grep queue_directory
# Typical locations:
/etc/postfix/
/usr/local/etc/postfix/
/var/lib/postfix/

The master.cf file is typically located in the same directory as main.cf. If missing, you might need to reinstall Postfix or create it manually.

For modifying CPPOP (assuming you're referring to custom Postfix POP implementations), consider these approaches:

# Example: Adding POP3 service to master.cf
pop3     inet  n       -       n       -       -       dovecot
pop3s    inet  n       -       n       -       -       dovecot

# Common modifications include:
# - Changing port numbers
# - Adjusting timeout settings
# - Enabling/disabling features

Here are some practical configuration snippets:

# Postfix main.cf example for basic setup
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
relayhost = 
mynetworks = 127.0.0.0/8
  • Check mail logs: tail -f /var/log/mail.log or /var/log/maillog
  • Test configuration: postfix check and postfix reload
  • Verify service status: systemctl status postfix or service postfix status