Setting Daemon Mode for Sendmail

by Mike on November 14, 2008 · 1 comment

in Sendmail Mail Server

You have a number of switches that you can use for Sendmail to manage it in the way that best meets your needs.  Daemon mode will listen all of the time for connections to your Sendmail server.

Switch  Description  Commands

-ba  Use ARPnet protocols
-bD  Run as daemon but do not fork
-bd  Run as daemon
-bH  Purge persistent host status
-bh  Print persistent host status
-bi  Rebuild alias database  newaliases
-bm  Be a mail sender

-bp  Print the queue  mailq
-bs  Run SMTP on standard output
-bt  Test mode
-bv  Verify

Daemon Mode (-bd)
Daemon mode provides a way for sendmail to listen for connections to the server. This is the typical method of setting up sendmail for a busy mail server. An alternative is to setup sendmail to check for mail on a regular time interval. The difference is that when sendmail is listening in daemon mode it is in a sense always on. This presents the greatest security risks as well since the server will be seen easily on the Internet. If you want to run sendmail in daemon mode you will need to tell it to do so, run this command:

sendmail -bd

The server can be setup to listen for incoming mail and to send mail stored in the queue on a regular basis, each hour for example. Try this command:

/usr/lib/sendmail -bd -q1h

This allows sendmail to listen constantly for mail and to check the queue each hour to send mail that is there.   There are major security advantages to using this configuration.  This will expose your mail server to the Internet for a fraction of the time if it was running in daemon mode.  However, if you have a lot of traffic this is not the best option as it will overload your server.

One thing to remember when sendmail is running in daemon mode is that any changes you make to the configuration will not be active until you restart sendmail. Restarting sendmail may be accomplished as root:
% kill -HUP `head -1 /etc/`
Once sendmail restarts all of the configuration changes will be active.

{ 1 trackback }

Previous post:

Next post: