''-C'' '''


Location of the configuration file All versions

The -C command-line switch tells sendmail where to find its configuration file. The form of the -C switch is:

-C path

With V8 sendmail, space between the -C and the path is optional. The path specifies the location of the configuration file. That location can be either a relative or a full pathname. If path is missing, the location becomes the file sendmail.cf in the current directory.

The -C command-line switch causes sendmail to internally mark the configuration file as unsafe. An unsafe configuration file prevents all but root from setting certain options and causes sendmail to change its uid and gid to that of the user that ran it. If it is used by someone other than the superuser (and if in other than -bt rule-testing mode), the -OQueueDirectory=path switch should also be used to set the location of the queue directory. If that location is not changed, sendmail fails because it cannot chdir(2) into its queue directory.

Prior to V8 the -C command-line switch also prevented sendmail from "thawing" its frozen configuration file.

One practical use for this command-line switch might be as part of a make(1) file that is used to generate a cf file from your mc file. Consider, for example, that you maintain the mc source for your configuration file in a directory that is separate from the sendmail source directory. If such a directory were /usr/local/src/sendmail/cf, and if the sendmail source were located in /usr/local/src/sendmail/8.12.7, you could create a Makefile something like this in the cf directory:

M4=/usr/ccs/bin/m4                       for Solaris 5.4
MC_FILE=yourhost                         the base name of your mc file
SENDMAIL=/usr/sbin/sendmail              where your sendmail is located

        @echo building
        @$(M4) -D_CF_DIR_=$(CFDIR) $(CFDIR)m4/cf.m4 ${MC_FILE}.mc > ${MC_FILE}.cf
        @echo testing
        @$(SENDMAIL) -C${MC_FILE}.cf -bt < /dev/null > /dev/null;
        mv /etc/mail/sendmail.cf /etc/mail/sendmail.cf.save
        cp ${MC_FILE}.cf /etc/mail/sendmail.cf

Thereafter, to generate and install a new configuration file you just run the following commands:

% cd /usr/local/src/sendmail/cf
% make
% sudo make install
mv /etc/mail/sendmail.cf /etc/mail/sendmail.cf.save
cp yourhost.cf /etc/mail/sendmail.cf

As you gather more machines to administer, you can centralize many mc files in one place and update the configuration files with a single command.

    Part I: Build and Install
    Part II: Administration
    Part III: The Configuration File