Disable sendmail in FreeBSD

Aditya KumarAditya Kumar
1 min read

I do not use emails on my FreeBSD machine so I did not bother setting it up. But it runs at startup and apparently prevents other services from starting till it finishes its job (I cannot ssh into this machine till sendmail decides it has had enough and stops).

Change these lines to /etc/mail/mailer.conf to

sendmail   /usr/bin/true
mailq      /usr/bin/true
newaliases /usr/bin/true
hoststat   /usr/bin/true
purgestat  /usr/bin/true

And in /etc/periodic/periodic.conf to

# disable sendmail (mailqueue) cleanups:
daily_clean_hoststat_enable="NO"
daily_status_mail_rejects_enable="NO"
daily_status_mailq_enable="NO"
daily_submit_queuerun="NO"

# disable periodic's emailing by logging!
daily_output=/var/log/daily.log
weekly_output=/var/log/weekly.log
monthly_output=/var/log/monthly.log

# put these into the log, instead of trying to mail them
daily_status_security_inline="YES"
weekly_status_security_inline="YES"
monthly_status_security_inline="YES"

And in /etc/rc.conf to

# disable sendmail
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_msp_queue_enable="NO"
sendmail_outbound_enable="NO"

# don't allow cron to mail
cron_flags="-m ''"

Instructions taken from https://gist.github.com/igalic/c77ed494e102977c9fd06ce9b053cda0

0
Subscribe to my newsletter

Read articles from Aditya Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Aditya Kumar
Aditya Kumar

Student