Rebuild the Alias Database

You tell sendmail to rebuild its database files by running it in -bi mode. This mode can be executed in two different ways:

% newaliases
% /usr/sbin/sendmail -bi

The first form is shorthand for the second. Either causes sendmail to rebuild those files. If the database is successfully built, sendmail prints a single line:

895 aliases, longest 565 bytes, 30444 bytes total

This shows that 895 entries appeared to the left of colons in the aliases file. The longest list of addresses to the right of a colon was 565 bytes (excluding the newline). And there were 30,444 total bytes of noncomment information in the file.

V8 sendmail supports multiple alias database files (see the AliasFile option, AliasFile on page 970). Consequently, each line of its output is prefixed with the name of the aliases file being rebuilt. For example:

/etc/aliasdir/users: 895 aliases, longest 565 bytes, 30444 bytes total
/etc/aliasdir/lists: 34 aliases, longest 89 bytes, 1296 bytes total

Beginning with V8.11, sendmail allows only root and the user listed with the TrustedUser option (TrustedUser on page 1112) to rebuild the aliases database.[206] If you are neither, you will see the following error message, and the database rebuild will fail:

Permission denied (real uid not trusted)

[206] * V8.12 and above sendmail are no longer set-user-id root, which further limits who can rebuild aliases.

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.