The -D Debug File Switch

The -D command-line switch is used to redirect sendmail’s debugging output into a file for later examination. It is used like this, where file is the name of an existing or new file:

-D file

The -D command-line switch (if used) must precede the -d switch on the same command line; otherwise, the following error will print and all debugging output will be printed to the standard output (possibly causing you to miss seeing the error):

-D file must be before -d

The file specified with -D must live in a directory that is writable by the user running sendmail. If the file does not exist, it will be created. If the file already exists, it will be silently appended to.

Extra care must be exercised when using the -D command-line switch as root because the target file will be appended to, even if it is a symbolic link to an important file. For example, when /tmp/foo is a non-root-owned symbolic link that points to /etc/passwd, the following command line, when run by root, will silently append debugging information to the /etc/passwd file:

# /usr/sbin/sendmail -D /tmp/foo -d0.1 -bt < /dev/null

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.