![]() ![]() |
24.2 Command-Line OptionsBeginning with V8.7 sendmail, command-line options can have multicharacter option names. Prior to V8.7, only single-character names were allowed. We describe the old form first, then the new. 24.2.1 Pre-V8.7 Command-Line Option DeclarationsPrior to V8.7, option names that are declared on the command line could be only a single character long: -oXargument The -o switch (lowercase o) is immediately followed (with no intervening space) by the one-letter name of the option (here, X). The one-letter names are case-sensitive (x is not the same as X). Depending on the option selected, an argument might be required. If that argument is present, it must immediately follow the option name with no intervening space. Only one option can be specified for each -o switch. Under V8 sendmail a space can appear between the -o and the X, but no space can exist between the X and its argument. This is because V8 sendmail uses getopt(3) to parse its command line. If an unknown single-character option name is used, sendmail will print and log the following error: readcf: unknown option name 0x31 Here, the unknown character was a 1, printed in hexadecimal notation. 24.2.2 Multicharacter Command-Line OptionsBeginning with V8.7, option names can be single-character or multicharacter. Single-character options are declared with the -o (lowercase) switch as described earlier. Multicharacter options, which are preferred, are declared with a -O (uppercase) switch: -OLongName=argument Space can optionally exist between the -O and the LongName. In the command line, space cannot exist between the LongName, the =, and the argument unless they are quoted: -O "LongName = argument" Only one option can be specified for each -O switch. The sendmail program ignores case when it considers multicharacter names. Therefore, the following three command lines have the same effect, and none produces an error: -OQueueDirectory=/var/spool/mqueue -Oqueuedirectory=/var/spool/mqueue -OQuEuEdIrEcToRy=/var/spool/mqueue Multicharacter names are beneficial because they allow option names to have mnemonic recognition. For example, the multicharacter name ForwardPath, which lists the default path for ~/.forward files, is much more recognizable than the single-character name J. If an unknown multicharacter option name is specified, the following is logged and printed: readcf: unknown option name bad name here 24.2.2.1 Multicharacter name shorthandBeginning with V8.7, multicharacter names in the command line can be specified by using the fewest unique leftmost characters in the name. For example, you can specify the queue directory with the complete QueueDirectory long name: % /usr/sbin/sendmail -OQueueDirectory=/var/spool/mqueue But if you need to run this command line frequently,[3] you might find it handy to use an abbreviation:
% /usr/sbin/sendmail -OQueueDir=/var/spool/mqueue Option QueueDir used as abbreviation for QueueDirectory Whenever a multicharacter name is abbreviated, sendmail prints a warning (the second line in the previous example) to discourage you from using abbreviations inside your configuration file. It will also warn you if you specify too few leftmost letters: % /usr/sbin/sendmail -OQueue=/var/spool/mqueue readcf: ambiguous option name Queue (matches QueueFactor and QueueDirectory) If you misspell the single-character or multicharacter name, the following error is printed, and the option declaration is skipped: % /usr/sbin/sendmail -OQueDirectory=/var/spool/mqueue readcf: unknown option name QueDirectory Although these abbreviations can be handy on command lines, it is vital that you always use nonabbreviated names in your configuration file. New options will be added to sendmail over time, and the use of abbreviations can lead to future unexpected or ambiguous effects. 24.2.3 Appropriateness of OptionsSome options are intended for use only on the command line and make little or no sense when used in the configuration file. Options that are inappropriate in the configuration file are shown in Table 24-1.
24.2.4 Options That Are SafeSecurity considerations normally require that sendmail give up any special privileges for most command-line options specified by the ordinary user. But the ordinary user can specify a few options that allow sendmail to keep its special privilege. Those options are called "safe" and are shown in Table 24-2.
For example, the AliasFile option (location of the aliases file) is unsafe (and is not in Table 24-2). If you were to send mail by specifying a new location with the AliasFile option, sendmail would change its identity from root to an ordinary user (you), thus preventing sendmail from being able to queue its mail: /var/spool/mqueue: Permission denied Note that prior to V8.8.4, the DontInitGroups and TryNullMXList options were wrongly set to safe. This is yet another reason to always upgrade to the latest version of sendmail. ![]() |
![]() ![]() |