sdparm

title: sdparm(8)

text:
# sdparm(8)

## NAME
sdparm - access SCSI modes pages; read VPD pages; send simple SCSI commands.

## SYNOPSIS
sdparm [--all] [--dbd] [--examine] [--flexible] [--get=STR] [--hex] [--long] [--num-desc] [--out-mask=OM] [--page=PG[,SPG]] [--quiet] [--readonly] [--six] [--transport=TN] [--vendor=VN] [--verbose] DEVICE [DEVICE...]

sdparm [--clear=STR] [--defaults] [--dummy] [--flexible] [--page=PG[,SPG]] [--quiet] [--readonly] [--save] [--set=STR] [--six] [--transport=TN] [--vendor=VN] [--verbose] DEVICE [DEVICE...]

sdparm --command=CMD [--hex] [--long] [--readonly] [--verbose] DEVICE [DEVICE...]

sdparm --inquiry [--all] [--examine] [--flexible] [--hex] [--num-desc] [--page=PG[,SPG]] [--quiet] [--readonly] [--transport=TN] [--verbose] DEVICE [DEVICE...]

sdparm --enumerate [--all] [--inquiry] [--long] [--page=PG[,SPG]] [--transport=TN] [--vendor=VN]

sdparm --inhex=FN [--all] [--flexible] [--hex] [--inquiry] [--long] [--pdt=DT] [--raw] [--six] [--transport=TN] [--vendor=VN] [--verbose]

sdparm --wscan [--verbose]

sdparm [--help] [--version]

## DESCRIPTION
This utility fetches and potentially changes SCSI device (e.g. disk) mode pages. Inquiry data including Vital Product Data (VPD) pages can also be displayed. Commands associated with starting and stopping the medium; loading and unloading the medium; and other housekeeping functions may also be issued by this utility.

The first invocation shown in the synopsis is for accessing (i.e. reading) mode page fields held on the DEVICE. The second form is for changing mode page fields held on the DEVICE. The third form is for executing some simple SCSI commands. The fourth form (i.e. the '--inquiry ... DEVICE' form) is for fetching and decoding VPD pages from the given DEVICE. The --enumerate form is for listing out mode or VPD field data held by this utility (and if a DEVICE is given then it is ignored). The --inhex=FN form decodes mode or VPD response data provided in the named file (or from stdin if FN=- is given); that data may either be in hexadecimal or binary. The second last form is for Windows only and lists the available storage device names; see the OPTIONS entry for --wscan. The final form is to provide command line help or the version number (and date) of this utility.

If no options (other than DEVICE) are given then a selection of common mode page fields for that device are listed. If the --long option is also given then a description of the fields is placed on the right of each line. If the --all option is given then all known mode page fields for that device are listed. Individual fields can be displayed with the --get=STR option (e.g. '--get=WCE' to fetch the state of the Writeback Cache Enable field).

This utility completes with an exit status of 0 when successful. For other values see the EXIT STATUS section below.

One or more DEVICE arguments can be given. The utility will essentially apply the given options to each DEVICE in the list. If a error is detected, it is noted and the utility continues. Error value 5 (file open or close problem) is treated as lower priority when other errors are detected. The exit status is the most recently detected error value (excluding error value 5 if other errors have been detected). If all actions succeed the exit status is zero.

By default this utility shows mode pages that are common to all transport protocols. These are termed as "generic" mode pages. If there is no match on a generic mode page name or field then those pages specific to the SAS transport are checked. Transport protocol specific mode pages are selected with the --transport=TN option. See the TRANSPORT section below. Vendor specific mode pages are selected with the --vendor=VN option. See the VENDORS section below.

Although originally for SCSI disks (or storage devices that appear to the OS as SCSI disks) many of the mode pages are for other SCSI device types. These include CD/DVD players that use the ATAPI (or any other) transport, SCSI tapes drives and SCSI enclosures.

When the --inquiry option is given without a page number then the Device Identification VPD page (page number 0x83) is requested and if found it is decoded and output. If no page number is given and the --all option is given then a list of VPD page names (but not their contents) supported by the DEVICE is output. When both the --inquiry and --page=PG options are given then the VPD page can be specified as an abbreviation (e.g. "sp" for the SCSI ports VPD page) or numerically (e.g. "0x88"). If a VPD page is returned by the DEVICE but sdparm cannot decode it or the --hex option is given then it is output in hex.

## OPTIONS
Mandatory arguments to long options are mandatory for short options as well. If an option takes a numeric argument then that argument is assumed to be decimal unless otherwise indicated (e.g. with a leading "0x" or a trailing "h"). The options are in alphabetical order, based on the long option name.

-a, --all

output all recognized fields for the device type (e.g. disk) of the DEVICE. Without this option (or the --page=PG[,SPG] option) the default action is to output a relatively small number of commonly used fields from different pages. When a specific (mode) page number is given with the --page=PG[,SPG] option then all the fields of that page are output (irrespective of the setting of this option). For this option's action when used with the --enumerate option see the ENUMERATE section below.

When used together with the --inquiry option and a DEVICE, the Supported VPD Pages VPD page [0x0] is output. When this option is used twice (short form: '-iaa') then all VPD pages (listed in the Supported VPD Pages VPD page) are output.

By default --inhex=FN will only decode the first mode page found in FN. With this option, more mode pages will be decoded if present. When --transport=TN or --vendor=VN is also given then if a given mode page is not defined for that transport or vendor, then it is decoded as a generic mode page.

-c, --clear=STR

In its simplest form STR contains a field acronym_name or a field numerical descriptor. In the absence of an explicit value argument (e.g. '--clear=WCE=1'), the field has its value cleared to zero. See the PARAMETERS section below.

-C, --command=CMD

Perform given CMD. See section below on COMMANDS. To enumerate supported commands use '-e -C x' (using any CMD name, valid or otherwise).

-B, --dbd

disable block descriptors. This is a bit in MODE SENSE cdbs that rarely needs to be set. One known case is a MODE SENSE 6 issued to a Reduced Block Commands (RBC) device where the RBC standard says it shall be set.

-D, --defaults

sets the given mode page to its default values. Requires the --page=PG[,SPG] option to be given to specify the mode page. To make the default mode page values also the saved mode page values, use the --save option as well.

when this option is used twice, the current values in all modes pages are reverted to their defaults. If the --save option is given as well, then the current and saved values in all modes pages are reverted to their defaults. This feature uses the RTD bit in the MODE SELECT command which was added in draft SPC-5 revision 11.

-d, --dummy

when set inhibits changes being placed in the DEVICE's mode page. Instead the mode data that would have been sent to a MODE SELECT command, is output in ASCII hex to the console. This option is mainly for testing.

-e, --enumerate

lists out descriptive information about the pages and fields known to this utility. Ignores the DEVICE argument and other options apart from the --all, --inquiry, --long, --page=PG[,SPG], --transport=TN and --vendor=VN. If --enumerate is given without other options then the known (generic) mode pages are listed. See the ENUMERATE section below.

-E, --examine

for mode pages only those with known field names are probed when the --all option is given. For VPD pages only those pages listed in "Supported VPD pages page" are decoded. In both cases some pages may be missed. With this option (i.e. --examine) all mode and VPD pages can be probed.

For mode pages, this option will probe all mode pages from page number 0x0 to 0x3e. To probe mode subpages give a mode page number with --page=PG and then all subpages (from 0x0 to 0xfe) are probed.

For VPD pages, use this option with --inquiry. This will cause all VPD pages from 0x0 to 0xbf to be probed by default. A sequence of VPD pages can be probed with --page=PG[,SPG] in which case VPD pages from PG (lower number) to SPG (high number) inclusive are probed. Vendor specific VPD pages run from 0xc0 to 0xff and can be probed by setting SPG from 0xc0 to 0xff.

-f, --flexible

Some devices, bridges and/or drivers attempt crude transformations between mode sense 6 and 10 byte commands without correctly rebuilding the response. This will cause the response to be mis-interpreted (usually with an error saying the response is malformed). With this option, the length of the response is checked, and if it looks wrong, various corrections are attempted. This option will also allow mode pages that don't belong to the current device's peripheral type to be listed.

-g, --get=STR

In its simplest form STR contains a field acronym_name or a field numerical descriptor. The field is fetched from mode page. See the PARAMETERS section below. The --long and --hex options effect the output format. Also if a value of "1" is given (e.g. '--get=WCE=1') only the current value is output (i.e. not the change mask, the default value and the saved value).

-h, --help

output the usage message then exit.

-H, --hex

rather than trying to decode mode (or VPD) pages, print them out in hex. When used with the --get=STR option the corresponding current, changeable, default and saved values are output in hex, prefixed by "0x" and space separated. If a value of "1" is given with the --get=STR option (e.g. '--get=WCE=1') then only the current value is output in hex, prefixed by "0x". If a value of "2" is given with the --get=STR option then only the current value is output as a (signed) integer. This option can be used multiple times (e.g. '-HH'). Useful with the ATA Information VPD page which usually outputs its IDENTIFY (PACKET) DEVICE response in 16 bit hex words; with '-HH' outputs that response in hex bytes; with '-HHH' outputs the same response in a format suitable for 'hdparm --Istdin' to decode.

Mode page output with the '-HHH' option is suitable for a later invocation of sdparm with the --inhex=FN option.

-i, --inquiry

output a VPD page which is in the response of a SCSI INQUIRY command sent to DEVICE. In the absence of this option the default action is to output mode pages. If the --inquiry option is given without the --page=PG[,SPG] option then the device identification VPD page (0x83) is decoded and output. If this option and the --all option are given then the supported VPD pages page (0x0) is decoded and output.

-I, --inhex=FN

FN is expected to be a file name (or '-' for stdin) which contains ASCII hexadecimal (or binary) representing the response to MODE SENSE(10). If --six is also given then the response from MODE SENSE(6) is assumed. A MODE SENSE response contains a mode parameter header, then 0 or more block descriptors followed by one or more mode pages. This utility will only decode the first mode page unless the --all option is given. In order to decode a mode page the peripheral device type is often needed and can be supplied with the --pdt=DT option. If the --pdt=DT is not given then a mode page found in two device type standards (e.g. SBC and SSC) may be decoded twice.

If --inquiry is given then FN is interpreted as the response data of a single VPD page.

The hexadecimal in FN should be arranged as 1 or 2 digits representing a byte each of which is whitespace or comma separated. Anything from and including a hash mark to the end of line is ignored. If the --raw option is given then FN is treated as binary.

-l, --long

output extra information. In the case of mode page fields a description (with units if applicable) is output to the right. If used twice, then for some fields more information about its values is given on one or more following lines, each prefixed by a tab character. For usage with --enumerate see the ENUMERATE section below.

When this option is used along with --command=capacity then the READ CAPACITY(16) is sent to the DEVICE and if successful its extended response is output.

-n, --num-desc

for a mode page that can have descriptors, the number of descriptors for the given page on the DEVICE is output. Otherwise 0 is output.

-o, --out-mask=OM

OM is a bit mask for mode page selections that will be printed/output. The 0x1 value is for the 'current' values, 0x2 is for the 'changeable' values, 0x4 is for the 'default' values and 0x8 is for the 'saveable' values. The default value is 0xf (i.e. the OR of all four values set). The option is useful for limiting the amount of output with the '-HHH'.

-p, --page=PG[,SPG]

supply the page number (PG) and optionally the sub page number (SPG) of the mode (or VPD) page to fetch. These numbers are interpreted as decimal unless prefixed with "0x" or a trailing. Sub page numbers are only valid for mode pages (not VPD pages). Alternatively an abbreviation for a page can be given (see next entry).

-p, --page=STR

a two or three letter abbreviation for a page can be given. Known mode page abbreviations are checked first followed by known VPD page abbreviations. For example '--page=ca' matches the caching mode page. If no match is found then an error is issued and a list of possibilities in the current context is given (so '-p x' can be quite useful). If the STR matches a known VPD page abbreviation then the --inquiry option is assumed. For usage with --enumerate see the ENUMERATE section below.

-P, --pdt=DT

This option is only active when the --inhex=FN option is given. DT is the peripheral Device Type, a value between 0 and 31 and can be found in the response to the INQUIRY command. The default value is -1 (which may also be given for DT) and it is interpreted as SPC (i.e. common mode pages) or as a wild card. If available this option should be supplied with the --inhex=FN option.

-q, --quiet

suppress output of device name followed by the vendor, product and revision strings fetched from an INQUIRY response. Without this option such a line is typically the first line output by sdparm. Reduces output from the device identification VPD page, typically to one line (or none) for each of di_lu, di_port, di_target and di_asis.

If this option is used twice then additionally mode page output suppresses the changeable, default and saved values that are usually shown in braces, if available.

-r, --readonly

override other logic to open DEVICE in read-only mode. The default setting of the open read-only/read-write mode depends on the operation requested (e.g. a --set=STR operation by default will try a read-write mode open on DEVICE). This option may be useful if a command is being sent to an ATA disk via a SCSI command set. For example in Linux '-C stop' may require this option to stop an ATA disk being restarted immediately.

-R, --raw

this option is only active when used with the --inhex=FN option. When this option is given then the file FN is interpreted as binary; the default action (i.e. when this option is not given) is to interpret FN as ASCII hexadecimal.

-S, --save

when a mode page is being modified (by using the --clear=STR and/or --set=STR options) then the default action is to modify only the current values mode page. When this option is given then the corresponding value(s) in the saved values mode page is also changed. The next time the device is power cycled (or reset) the saved values mode page becomes (i.e. is copied to) the current values mode page. This option sets the SP field in the MODE SELECT command. See NOTES section below.

-s, --set=STR

in its simplest form STR contains a field acronym_name or a field numerical descriptor. In the absence of an explicit value, each acronym_name has its value set to (all) ones. This means a 16 bit field will be set to 0xffff which is 65535 in decimal. Alternatively each acronym_name or numerical descriptor may be followed by "=<n>" where <n> is the value to set that field to. See the PARAMETERS section below.

-6, --six

The default action of this utility is to issue MODE SENSE and MODE SELECT SCSI commands with 10 byte cdbs. When this option is given the 6 byte cdb variants are used. RBC and old SCSI devices may need this option. This utility outputs a suggestion to use this option if the SCSI status indicates that the 10 byte cdb variant is not supported.

The SPC-4 standard (and SPC-5 drafts) include a note stating that implementers migrate away from the SCSI MODE SELECT(6) and MODE SENSE(6) commands in favour of the 10 byte variants (e.g. MODE SEMSE(10)).

-t, --transport=TN

Specifies the transport protocol where TN is either a number in the range 0 to 15 (inclusive) or an abbreviation (e.g. "fcp" for the Fibre Channel Protocol). Some transports accept multiple abbreviations, for example srp (SCSI RDMA Protocol) and ib (short for InfiniBand) both are accepted for transport protocol 0x4 . Also both upper and lower case are accepted so iscsi and iSCSI are accepted for transport protocol 0x5 . One way to list available transport protocols numbers and their associated abbreviations is to give an invalid transport protocol name such as '-t x'; another way is '-e -l'. N.B. The --all option may still be needed to show all available fields.

-M, --vendor=VN

Specifies the vendor (i.e. manufacturer) where VN is either a number (0 or more) or an abbreviation (e.g. "sea" for Seagate disk vendor specific). For tape drives "lto5" and "lto6" are treated as vendors. One way to list the available vendor numbers and their associated abbreviations is to give an invalid vendor number such as '-M x'; another way is '-e -l'.

This option only effects mode page decodes, not VPD pages. For vendor specific VPD pages see the sg_vpd utility.

-v, --verbose

increase the level of verbosity, (i.e. debug output). In some cases more decoding is done (e.g. fields within a standard INQUIRY response).

-V, --version

print the version string and then exit.

-w, --wscan

this option is available in Windows only. It lists storage device names and the corresponding volumes, if any. When used twice it adds the "bus type" of the closest transport (e.g. a SATA disk in a USB connected enclosure has bus type Usb). When used three times a SCSI adapter scan is added. When used four times only a SCSI adapter scan is shown. See examples below and the "Win32 port" section in the README file.

## NOTES
The reference document used for interpreting mode and VPD pages (and the INQUIRY standard response) is T10/BSR INCITS 502 Revision 17 (SPC-5, 19 September 2017) found at http://www.t10.org . Obsolete and reserved items in the standard INQUIRY response output are displayed in brackets. Recent drafts of other T10 documents are also used: SBC-4 (disks), SSC-5 (tapes), SPL-5 (SAS transport) and SAT-4 (SCSI to ATA Translation).

A mode page for which no abbreviation is known (e.g. a vendor specific mode page) can be listed in hexadecimal by using the option combination '--page=PG --hex'.

Numbers input to sdparm (e.g. in the command line arguments) are assumed to be in decimal unless there is a hexadecimal indicator. A hexadecimal indicator is either a leading '0x' or '0X' (i.e. the C language convention) or a trailing 'h' or 'H' (i.e. the convention used at www.t10.org ). In the case of --page= either a string or number is expected, so hex numbers like 'ch' (12) should be prefixed by a zero (e.g. '0ch').

The SPC-4 draft (rev 2) says that devices that implement no distinction between current and saved pages can return an error (ILLEGAL REQUEST, invalid field in cdb) if the SP bit (which corresponds to the --save option) is _not_ set. In such cases the --save option needs to be given.

If the --save option is given but the existing mode page indicates (via its PS bit) that the page is not saveable, then this utility generates an error message. That message suggests to try again without the --save option.

Since the device identification VPD page (acronym_name "di") potentially contains a lot of diverse designators, several associated acronyms are available. They are "di_lu" for designators associated with the addressed logical unit, "di_port" for designators associated with the target port (which the command arrived via) and "di_target" for designators associated with the target device. When "di" is used designators are grouped by lu, then port and then target device. To see all designators decoded in the order that they appear in the VPD page use "di_asis".

Only those VPD pages defined by t10.org are decoded by this utility. SPC-4 sets aside VPD pages codes from 0xc0 to 0xff (inclusive) for vendor specific pages some of which are decoded in the sg_vpd utility.

To see all VPD pages supported by a DEVICE use 'sg_vpd --all'.

In the linux kernel 2.6 and 3 series any device node that understands a SCSI command set (e.g. SCSI disks and CD/DVD drives) may be specified. More precisely the driver that "owns" the device node must support the SG_IO ioctl. In the lk 2.4 series only SCSI generic (sg) device nodes support the SG_IO ioctl. However in the lk 2.4 series other SCSI device nodes are mapped within this utility to their corresponding sg device nodes. So if there is a SCSI disk at /dev/sda then 'sdparm /dev/sda' will work in both the lk 2.4 series and later. However if there is an ATAPI cd/dvd drive at /dev/hdc then 'sdparm /dev/hdc' will only work in the lk 2.6 series and later.

In the Linux 2.6 and 3 series, especially with ATA disks, using sdparm to stop (spin down) a disk may not be sufficient and other mechanisms will start the disk again some time later. The user might additionally mark the disk as "offline" with 'echo offline > /sys/block/sda/device/state' where sda is the block name of the disk. To restart the disk "offline" can be replaced with "running".

## PARAMETERS
In their simplest form the --clear=, --get= and --set= options (or their short forms) take an acronym_name such as "WCE". In the case of '--get=WCE' the value of "Writeback Cache Enable" in the caching mode page will be fetched. In the case of '--set=WCE' that bit will be set (to one). In the case of '--clear=WCE' that bit will be cleared (to zero). When an acronym_name is given then the mode page is imputed from that acronym_name (e.g. WCE is in the caching mode page).

Instead of an acronym_name a field within a mode page can be described numerically with a <start_byte>:<start_bit>:<num_bits> tuple. These are the <start_byte> (origin 0) within the mode page, a <start_bit> (0 to 7 inclusive) and <num_bits> (1 to 64 inclusive). For example, the low level representation of the RCD bit (the "Read Cache Disable bit in the caching mode page) is "2:0:1". The <start_byte> can optionally be given in hex (e.g. '--set=0x2:0:1' or '--set=2h:0:1'). With this form the --page= option is required to establish which mode page is to be used.

Either form can optionally be followed by "=<val>". By default <val> is decimal but can be given in hex in the normal fashion. Here are some examples: '--set=2h:0:1=1h' and '-s MRIE=0x3'. When the acronym_name or numeric form following --clear= is not given an explicit '=<val>' then the value defaults to zero. When the acronym_name or numeric form following --set= is not given an explicit '=<val>' then the value defaults to "all ones" (i.e. as many as <num_bits> permits). For example '--clear=WCE' and '--clear=WCE=0' have the same meaning: clear Writeback Cache Enable or, put more simply: turn off the writeback cache.

Multiple fields within the same mode page can be changed by giving a comma separated list of acronym_names and/or the numerical form. For example: '--set=TEST,MRIE=6'.

Some mode page have multiple descriptors. They typically have a fixed header section at the start of the mode page that includes a field containing the number of descriptors that follow. Following the header is a variable number of descriptors. An example is the SAS Phy Control and Discover mode page. An acronym_name may include a trailing '.<num>' where "<num>" is a descriptor number (origin 0). For example '-t sas -g PHID.0' and '-t sas -g PHID' will yield the phy identifier of the first descriptor of the above mode page; '-t sas -g PHID.1' will yield the phy identifier of the second descriptor.

## ENUMERATE
The --enumerate option essentially dumps out static information held by this utility. A list of --enumerate variants and their actions follows. For brevity subsequent examples of options are shown in their shorter form.

--enumerate list generic mode page information

-e --all list generic mode page contents

(i.e. parameters)

-e --page=rw list contents of read write error

recovery mode page

-e --inquiry list VPD pages this utility can decode

-e --long list generic mode pages, transport

protocols, mode pages for each

supported transport protocol and

supported commands

-e -l --all additionally list the contents of

each mode page

-e --transport=fcp list mode pages for the fcp

transport protocol

-e -t fcp --all additionally list the contents of

each mode page

-e --vendor=sea list vendor specific mode pages for

"sea" (Seagate)

-e -M sea --all additionally list the contents of vendor

specific mode pages for "sea" (Seagate)

-e -p pcd -l list contents of SAS phy control and

discovery mode page plus (due to "-l")

some descfriptor format information

When known mode pages are listed (via the --enumerate option) each line starts with a two or three letter abbreviation. This is followed by the page number (in hex prefixed by "0x") optionally followed by a comma and the subpage number. Finally the descriptive name of the mode page (e.g. as found in SPC-4) is output.

When known parameters (fields) of a mode page are listed, each line starts with an acronym (indented a few spaces). This will match (or be an acronym for) the description for that field found in the (draft) standards. Next are three numbers, separated by colons, surrounded by brackets. These are the start byte (in hex, prefixed by "0x") of the beginning of the field within the mode page; the starting bit (0 through 7 inclusive) and then the number of bits. The descriptive name of the parameter (field) is then given. If appropriate the descriptive name includes units (e.g. "(ms)" means the units are milliseconds). Adding the '-ll' option will list information about possible field values for selected mode page parameters.

Mode parameters for which the num_bits is greater than 1 can be viewed as unsigned integers. Often 16 and 32 bit fields are set to 0xffff and 0xffffffff respectively (all ones) which usually has a special meaning (see drafts). This utility outputs such values as "-1" to save space (rather than their unsigned integer equivalents). "-1" can also be given as the value to a mode page field acronym (e.g. '--set=INTT=-1' sets the interval timer field in the Informational Exceptions control mode page to 0xffffffff).

## TRANSPORTS
SCSI transport protocols are a relatively specialized area that can be safely ignored by the majority of users.

Some transport protocols have protocol specific mode pages. These are usually the disconnect-reconnect (0x2), the protocol specific logical unit (0x18) and the protocol specific port (0x19) mode pages. In some cases the latter mode page has several subpages. The most common transport protocol abbreviations likely to be used are "fcp", "spi" and "sas".

Many of the field names are re-used in the same position so the acronym_name namespaces have been divided between generic mode pages (i.e. when the --transport= option is _not_ given) and a namespace for each transport protocol. A LUPID field from the protocol specific logical unit (0x18) mode page and the PPID field from protocol specific port (0x19) mode page are included in the generic modes pages; this is so the respective (transport) protocol identifiers can be seen. In most cases the user will know what the "port" transport is (i.e. the same transport as the HBA in the computer) but the logical unit's transport could be different.

## VENDORS
SCSI leaves a lot of space for vendor specific information. Often this is described in product manuals. The --vendor=VN (or -M=VN) option allows known vendor specific mode pages to be examined and/or modified by acronym.

In this utility the syntax and semantics of vendor specific mode pages is very similar to those of transport protocol specific mode pages. Both cannot be specified together. Vendor specific modes pages can still be accessed numerically (as shown at the end of the EXAMPLES section).

## COMMANDS
The command option sends a SCSI command to the DEVICE. If the command fails then this is reflected in the non-zero exit status. To obtain more information about the error use the -v option.

capacity

sends a READ CAPACITY(10) command (valid for disks and cd/dvd media) by default. If successful yields "blocks: " [the number of blocks], "block_length: " [typically either 512 or 2048] and "capacity_mib: " [capacity in MibiBytes (1048576 byte units)].

If the number of blocks is too large to fit in the 4 byte field provided by READ CAPACITY(10) or, the --long option is given, then the READ CAPACITY(16) command is sent. If the --long option is given, then the extra fields found in the READ CAPACITY(16) response are output.

eject

stops the medium and ejects it from the device. Note that ejection (by command or button) may be prevented in which case the 'unlock' command may be useful in extreme cases. Typically only appropriate for cd/dvd drives and disk drives with removable media. Objects if sent to another peripheral device type (but objection can be overridden with '-f' option).

load

loads the medium and starts it (i.e. spins it up). See 'eject' command for supported device types.

profile

lists the various formats that a CD/DVD/HD-DVD/BD drive supports. These are called "profiles" in the MMC standard. The profiles are listed one per line. If media is in the drive then the profile that matches the media (if any) has an "*" to the right of the line.

ready

sends the "Test Unit Ready" SCSI command to the DEVICE. No error is reported if the device will respond to data requests (e.g. READ) in a reasonable timescale. For example, if a disk is stopped then it will report "not ready". All devices should respond to this command.

sense

sends a REQUEST SENSE command. It reports a hardware threshold exceeded, warning or low power condition if flagged. If a progress indication is present (e.g. during a format) then it will be output as a percentage. Yields a process status of 0 if the command succeeds and the sense key is 0; else yields 1. The --quiet option can be used to lessen output, and --hex to output sense data in hex.

speed=SPEED

permits the speed of a CD, DVD, HD_DVD or BD disc in a drive to be set (or at least influenced). It has this format: --command=speed=SPEED where SPEED is in kilobytes per second. In this case a kilobyte is 1000 bytes. The "times one" speed for a CD is 176.4 kB/s, for a DVD is 1350 kB/s and for both HD-DVD and BD it is 4500 kB/s. If SPEED is zero then the drive is set to the speed that it considers gives optimal performance. This command sends a SET STREAMING multi-media command (MMC) to the drive. The EXACT bit is clear so the drive will round the given SPEED as necessary. The command is designed to control read speed; setting write speed should be left to "burning" programs.

start

starts the medium (i.e. spins it up). Harmless if medium has already been started. See 'eject' command for supported device types. If the DEVICE is an ATA disk in Linux the '--readonly' option may be required.

stop

stops the medium (i.e. spins it down). Harmless if medium has already been stopped. See 'eject' command for supported device types. If the DEVICE is an ATA disk in Linux the '--readonly' option may be required. See the NOTES section above.

sync

sends a SYNCHRONIZE CACHE command. The device should flush any data held in its (volatile) buffers to the media.

unlock

tells a device to allow medium removal. It uses the SCSI "prevent allow medium removal" command. This is desperation stuff, possibly overriding a prevention applied by the OS on a mounted file system. The "eject" utility (from the "eject" package) is more graceful and should be tried first. This command is only appropriate for devices with removable media.

For loading and ejecting tapes the mt utility should be used (i.e. not these commands). The 'ready' command is valid for tape devices.

## EXAMPLES
To list the common (generic) mode parameters of a disk:

sdparm /dev/sda

To list the designators within the device identification VPD page of a disk:

sdparm --inquiry /dev/sda

To see all parameters for the caching mode page:

sdparm --page=ca /dev/sda

To see all parameters for the caching mode page with parameter descriptions to the right:

sdparm --page=ca --long /dev/sda

To get the WCE values (current changeable default and saved) in hex:

sdparm -g WCE -H /dev/sda

0x01 0x00 0x01 0x01

To get the WCE current value in hex:

sdparm -g WCE=1 -H /dev/sda

0x01

To set the "Writeback Cache Enable" bit in the current values page:

sdparm --set=WCE /dev/sda

To set the "Writeback Cache Enable" bit in the current and saved values page:

sdparm --set=WCE --save /dev/sda

To set the "Writeback Cache Enable" and clear "Read Cache Disable":

sdparm --set=WCE --clear=RCD --save /dev/sda

The previous example can also by written as:

sdparm -s WCE=1,RCD=0 -S /dev/sda

To re-establish the manufacturer's defaults in the current and saved values of the caching mode page:

sdparm --page=ca --defaults --save /dev/sda

If an ATAPI cd/dvd drive is at /dev/hdc then its common (mode) parameters could be listed in the lk 2.6 and 3 series with:

sdparm /dev/hdc

If there is a DVD in the drive at /dev/hdc then it could be ejected in the lk 2.6 and 3 series with:

sdparm --command=eject /dev/hdc

If the ejection is being prevented by software then that can be overridden with:

sdparm --command=unlock /dev/hdc

One disk vendor has a "Performance Mode" bit (PM) in the vendor specific unit attention mode page [0x0,0x0]. PM=0 is server mode (the default) while PM=1 is desktop mode. Desktop mode can be set (both current and saved values) with:

sdparm --page=0 --set=2:7:1=1 --save /dev/sda

The resultant change can be viewed in hex with the --hex option as there are no acronyms for vendor extensions yet. The PM bit is now covered by vendor specific mode pages and the above can also be accomplished with:

sdparm --vendor=sea --set=PM --save /dev/sda

What follows are some examples from Windows using the '--wscan' option. The idea is to list the storage device names on the system that might be invoked by other uses of sdparm.

\# sdparm --wscan

PD0 [C] FUJITSU MHY2160BH 0000

PD1 [DF] WD 2500BEV External 1.05 WD-WXE90

CDROM0 [E] MATSHITA DVD/CDRW UJDA775 CB03

So 'sdparm -a CDROM0' and 'sdparm -a E' will show all the (known) mode page fields for the Matshita DVD/CD drive. By using the '--wscan' option twice, the bus type (as seen by the OS) is added to the output:

\# sdparm -ww

PD0 [C] <Ata > FUJITSU MHY2160BH 0000

PD1 [DF] <Usb > WD 2500BEV External 1.05 WD-WXE90

CDROM0 [E] <Atapi> MATSHITA DVD/CDRW UJDA775 CB03

And the pattern continues to add a SCSI adapter scan. This may be useful if there are specialized storage related devices (e.g. a SES device in an enclosure) but does add much extra information in this case.

\# sdparm -www

PD0 [C] <Ata > FUJITSU MHY2160BH 0000

PD1 [DF] <Usb > WD 2500BEV External 1.05 WD-WXE90

CDROM0 [E] <Atapi> MATSHITA DVD/CDRW UJDA775 CB03

SCSI0:0,0,0 claimed=1 pdt=0h FUJITSU MHY2160BH 0000

SCSI1:0,0,0 claimed=1 pdt=5h MATSHITA DVD/CDRW UJDA775 CB03

## EXIT STATUS
To aid scripts that call sdparm, the exit status is set to indicate success (0) or failure (1 or more). Note that some of the lower values correspond to the SCSI sense key values. The exit status values are:

0

success

1

syntax error. Either illegal command line options, options with bad arguments or a combination of options that is not permitted.

2

the DEVICE reports that it is not ready for the operation requested. The device may be in the process of becoming ready (e.g. spinning up but not at speed) so the utility may work after a wait.

3

the DEVICE reports a medium or hardware error (or a blank check). For example an attempt to read a corrupted block on a disk will yield this value.

5

the DEVICE reports an "illegal request" with an additional sense code other than "invalid operation code". This is often a supported command with a field set requesting an unsupported capability. For commands that require a "service action" field this value can indicate that the command is not supported.

6

the DEVICE reports a "unit attention" condition. This usually indicates that something unrelated to the requested command has occurred (e.g. a device reset) potentially before the current SCSI command was sent. The requested command has not been executed by the device. Note that unit attention conditions are usually only reported once by a device.

7

the DEVICE reports a "data protect" sense key. This implies some mechanism has blocked writes (or possibly all access to the media).

9

the DEVICE reports an illegal request with an additional sense code of "invalid operation code" which means that it doesn't support the requested command.

10

the DEVICE reports a "copy aborted". This implies another command or device problem has stopped a copy operation. The EXTENDED COPY family of commands (including WRITE USING TOKEN) may return this sense key.

11

the DEVICE reports an aborted command. In some cases aborted commands can be retried immediately (e.g. if the transport aborted the command due to congestion).

14

the DEVICE reports a miscompare sense key. VERIFY and COMPARE AND WRITE commands may report this.

15

the utility is unable to open, close or use the given DEVICE. The given file name could be incorrect or there may be permission problems. Adding the -v option may give more information.

20

the DEVICE reports it has a check condition but "no sense". Some polling commands (e.g. REQUEST SENSE) can react this way. It is unlikely that this value will occur as an exit status.

21

the DEVICE reports a "recovered error". The requested command was successful. Most likely a utility will report a recovered error to stderr and continue, probably leaving the utility with an exit status of 0 .

22

the DEVICE reports that the current command or its parameters imply a logical block address (LBA) that is out of range.

24

the DEVICE reports a SCSI status of "reservation conflict". This means access to the DEVICE with the current command has been blocked because another machine (HBA or SCSI "initiator") holds a reservation on this DEVICE. On modern SCSI systems this is related to the use of the PERSISTENT RESERVATION family of commands.

25

the DEVICE reports a SCSI status of "condition met". Currently only the PRE-FETCH command (see SBC-4) yields this status.

26

the DEVICE reports a SCSI status of "busy". SAM-5 defines this status as the logical unit is temporarily unable to process a command. It is recommended to re-issue the command.

27

the DEVICE reports a SCSI status of "task set full".

28

the DEVICE reports a SCSI status of "ACA active". ACA is "auto contingent allegiance" and is seldom used.

29

the DEVICE reports a SCSI status of "task aborted". SAM-5 says: "This status shall be returned if a command is aborted by a command or task management function on another I_T nexus and the Control mode page TAS bit is set to one".

33

the command sent to DEVICE has timed out. This occurs in Linux only; in other ports a command timeout will appear as a transport (or OS) error.

40

the command sent to DEVICE has received an "aborted command" sense key with an additional sense code of 0x10. This value is related to problems with protection information (PI or DIF). For example this error may occur when reading a block on a drive that has never been written (or is unmapped) if that drive was formatted with type 1, 2 or 3 protection.

48

this is an internal message indicating a NVMe status field (SF) is other than zero after a command has been executed (i.e. something went wrong). Work in this area is currently experimental.

49

low level driver reports a response's residual count (i.e. number of bytes actually received by HBA is 'requested_bytes - residual_count') that is too high. So no useful processing can be done with that response.

50 + <os_error_number>

OS system calls that fail often return a small integer number to help indicate what the error is. For example in Unix the inability of a system call to allocate memory returns (in 'errno') ENOMEM which often is associated with the integer 12. So 62 (i.e. '50 + 12') may be returned by a utility in this case.

97

the response to a SCSI command failed sanity checks.

98

the DEVICE reports it has a check condition but the error doesn't fit into any of the above categories.

99

any errors that can't be categorized into values 1 to 98 may yield this value. This includes transport and operating system errors after the command has been sent to the device.

126

the utility was found but could not be executed. That might occur if the executable does not have execute permissions.

127

This is the exit status for utility not found. That might occur when a script calls a utility in this package but the PATH environment variable has not been properly set up, so the script cannot find the executable.

128 + <signum>

If a signal kills a utility then the exit status is 128 plus the signal number. For example if a segmentation fault occurs then a utility is typically killed by SIGSEGV which according to 'man 7 signal' has an associated signal number of 11; so the exit status will be 139 .

255

the utility tried to yield an exit status of 255 or larger. That should not happen; given here for completeness.

Most of the error conditions reported above will be repeatable (an example of one that is not is "unit attention") so the utility can be run again with the -v option (or several) to obtain more information.

## AUTHORS
Written by Douglas Gilbert.

## REPORTING BUGS
Report bugs to <dgilbert at interlog dot com>.

## COPYRIGHT
Copyright © 2005-2021 Douglas Gilbert

This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## WEB SITE
There is a web page discussing this package at https://sg.danny.cz/sg/sdparm.html .

## SEE ALSO
hdparm(hdparm), sg_modes, sg_wr_mode, sginfo, sg_inq, sg_vpd(all in sg3_utils), smartmontools(smartmontools.sourceforge.net), mt, eject(eject),


sedutil-cli

package: sedutil

title: sedutil-cli(8)

text:
# sedutil-cli(8)

## NAME
sedutil-cli - util to manage TCG Opal 2.0 self encrypting drives

## SYNOPSIS
sedutil-cli <-v> <-n> <action> <options> <device>

## DESCRIPTION
sedutil-cli is a utility to manage self encrypting drives that conform to the Trusted Computing Group (TCG) OPAL 2.0 SSC specification.

In Linux libata.allow_tpm must be set to 1. Either via adding libata.allow_tpm=1 to the kernel flags at boot time or changing the contents of /sys/module/libata/parameters/allow_tpm to a from a "0" to a "1" on a running system.

## OPTIONS

### General Options
-v (optional)

increase verbosity, one to five v's

-n (optional)

no password hashing. Passwords will be sent in clear text!

### Actions
--scan

Scans the devices on the system identifying Opal compliant devices

--query <device>

Display the Discovery 0 response of a device

--isValidSED <device>

Verify whether the given device is SED or not

--listLockingRanges <password> <device>

List all Locking Ranges

--listLockingRange <0...n> <password> <device>

List all Locking Ranges, 0 = GLobal 1..n = LRn

--eraseLockingRange <0...n> <password> <device>

Erase a Locking Range, 0 = GLobal 1..n = LRn

--setupLockingRange <0...n> <RangeStart> <RangeLength> <password> <device>

Setup a new Locking Range, 0 = GLobal 1..n = LRn

--initialSetup <SIDpassword> <device>

Setup the device for use with sedutil, <SIDpassword> is new SID and Admin1 password

--setSIDPassword <SIDpassword> <newSIDpassword> <device>

Change the SID password

--setAdmin1Pwd <Admin1password> <newAdmin1password> <device>

Change the Admin1 password

--setPassword <oldpassword, " for MSID> <userid> <newpassword> <device>

Change the Enterprise password for userid, "EraseMaster" or "BandMaster<n>", 0 <= n <= 1023

--setLockingRange <0...n> <RW|RO|LK> <Admin1password> <device>

Set the status of a Locking Range, 0 = GLobal 1..n = LRn

--enableLockingRange <0...n> <Admin1password> <device>

Enable a Locking Range, 0 = GLobal 1..n = LRn

--disableLockingRange <0...n> <Admin1password> <device>

Disable a Locking Range, 0 = GLobal 1..n = LRn

--setMBREnable <on|off> <Admin1password> <device>

Enable|Disable MBR shadowing

--setMBRDone <on|off> <Admin1password> <device>

set|unset MBRDone

--loadPBAimage <Admin1password> <file> <device>

Write <file> to MBR Shadow area

--revertTPer <SIDpassword> <device>

set the device back to factory defaults. This **ERASES ALL DATA**

--revertNoErase <Admin1password> <device>

deactivate the Locking SP without erasing the data on GLOBAL RANGE *ONLY*

----yesIreallywanttoERASEALLmydatausingthePSID <PSID> <device>

revert the device using the PSID. *ERASING* *ALL* the data

--printDefaultPassword <device>

print MSID

## EXAMPLES

```
sedutil-cli --scan
```

```
sedutil-cli --query /dev/sdc
```

```
sedutil-cli --yesIreallywanttoERASEALLmydatausingthePSID <PSIDALLCAPSNODASHED> /dev/sdc
```

```
sedutil-cli --initialSetup <newSIDpassword> /dev/sdc
```

## BUGS
Sleep (S3) is not supported.

## AUTHOR
The tool was developed by Bright Plaza Inc. <drivetrust@drivetrust.com>. This man page was written by Jan Luca Naumann <j.naumann@fu-berlin.de>.

branch: sisyphus


editmap

package: sendmail

title: editmap(8)

text:
# editmap(8)

## NAME
editmap - query and edit single records in database maps for sendmail

## SYNOPSIS
editmap [-C file] [-N] [-f] [-q|-u|-x] maptype mapname key [ "value ..." ]

## DESCRIPTION
Editmap queries or edits one record in database maps used by the keyed map lookups in sendmail(8). Arguments are passed on the command line and output (for queries) is directed to standard output.

Depending on how it is compiled, editmap handles different database formats, selected using the maptype parameter. They may be

dbm

DBM format maps. This requires the ndbm(3) library.

btree

B-Tree format maps. This requires the new Berkeley DB library.

hash

Hash format maps. This also requires the Berkeley DB library.

cdb

CDB (Constant DataBase) format maps. This requires the tinycdb library.

If the TrustedUser option is set in the sendmail configuration file and editmap is invoked as root, the generated files will be owned by the specified TrustedUser.

### Flags
-C

Use the specified sendmail configuration file for looking up the TrustedUser option.

-N

Include the null byte that terminates strings in the map (for alias maps).

-f

Normally all upper case letters in the key are folded to lower case. This flag disables that behaviour. This is intended to mesh with the -f flag in the K line in sendmail.cf. The value is never case folded.

-q

Query the map for the specified key. If found, print value to standard output and exit with 0. If not found then print an error message to stdout and exit with EX_UNAVAILABLE.

-u

Update the record for key with value or inserts a new record if one doesn't exist. Exits with 0 on success or EX_IOERR on failure.

-x

Deletes the specific key from the map. Exits with 0 on success or EX_IOERR on failure.

## SEE ALSO
sendmail(8), makemap(8)

## HISTORY
The editmap command has no history.


mail.local

title: mail.local(8)

summary: store mail in a mailbox

text:
# mail.local(8)

## NAME
mail.local - store mail in a mailbox

## SYNOPSIS
mail.local [-7] [-b] [-d] [-D mbdb] [-l] [-f from|-r from] [-h filename ] user ...

## DESCRIPTION
Mail.local reads the standard input up to an end-of-file and appends it to each user's mail file. The user must be a valid user name.

The options are as follows:

-7

Do not advertise 8BITMIME support in LMTP mode.

-b

Return a permanent error instead of a temporary error if a mailbox exceeds quota.

-d

Specify this is a delivery (for backward compatibility). This option has no effect.

-D mbdb

Specify the name of the mailbox database which is used to look up local recipient names. This option defaults to "pw", which means use getpwnam().

-f from

Specify the sender's name.

-l

Turn on LMTP mode.

-r from

Specify the sender's name (for backward compatibility). Same as -f.

-h filename

Store incoming mail in filename in the user's home directory instead of a system mail spool directory.

The next options are only available if mail.local has been compiled with -DHASHSPOOL.

-H hashtypehashdepth

Select hashed mail directories. Valid hash types are u for user name and m for MD5 (requires compilation with -DHASHSPOOLMD5). Example: -H u2 selects user name hashing with a hash depth of 2. Note: there must be no space between the hash type and the depth.

-p path

Specify an alternate mail spool path.

-n

Specify that the domain part of recipient addresses in LMTP mode should not be stripped.

Individual mail messages in the mailbox are delimited by an empty line followed by a line beginning with the string ``From ''. A line containing the string ``From '', the sender's name and a time stamp is prepended to each delivered mail message. A blank line is appended to each message. A greater-than character (``>'') is prepended to any line in the message which could be mistaken for a ``From '' delimiter line (that is, a line beginning with the five characters ``From '' following a blank line).

The mail files are exclusively locked with flock(2) while mail is appended, and a user.lock file also is created while the mailbox is locked for compatibility with older MUAs.

If the ``biff'' service is returned by getservbyname(3), the biff server is notified of delivered mail.

The mail.local utility exits 0 on success, and >0 if an error occurs.

## ENVIRONMENT
TZ

Used to set the appropriate time zone on the timestamp.

## FILES
/tmp/local.XXXXXX

temporary files

/var/mail/user

user's default mailbox directory

/var/mail/user.lock

lock file for a user's default mailbox

## SEE ALSO
mail(1), xsend(1), flock(2), getservbyname(3), comsat(8), sendmail(8)

## WARNING
mail.local escapes only "^From " lines that follow an empty line. If all lines starting with "From " should be escaped, use the 'E' flag for the local mailer in the sendmail.cf file.

## HISTORY
A superset of mail.local (handling mailbox reading as well as mail delivery) appeared in Version 7 AT&T UNIX as the program mail.


mailstats

title: mailstats(8)

summary: display mail statistics

text:
# mailstats(8)

## NAME
mailstats - display mail statistics

## SYNOPSIS
mailstats [-c] [-o] [-p] [-P] [-C cffile] [-f stfile]

## DESCRIPTION
The mailstats utility displays the current mail statistics.

First, the time at which statistics started being kept is displayed, in the format specified by ctime(3). Then, the statistics for each mailer are displayed on a single line, each with the following white space separated fields:

M

The mailer number.

msgsfr

Number of messages from the mailer.

bytes_from

Kbytes from the mailer.

msgsto

Number of messages to the mailer.

bytes_to

Kbytes to the mailer.

msgsrej

Number of messages rejected.

msgsdis

Number of messages discarded.

msgsqur

Number of messages quarantined.

Mailer

The name of the mailer.

After this display, a line totaling the values for all of the mailers is displayed (preceded with a ``T''), separated from the previous information by a line containing only equals (``='') characters. Another line preceded with a ``C'' lists the number of TCP connections.

The options are as follows:

-C

Read the specified file instead of the default sendmail configuration file.

-c

Try to use submit.cf instead of the default sendmail configuration file.

-f

Read the specified statistics file instead of the statistics file specified in the sendmail configuration file.

-P

Output information in program-readable mode without clearing statistics.

-p

Output information in program-readable mode and clear statistics.

-o

Don't display the name of the mailer in the output.

The mailstats utility exits 0 on success, and >0 if an error occurs.

## FILES
/etc/mail/sendmail.cf

The default sendmail configuration file.

/etc/mail/statistics

The default sendmail statistics file.

## SEE ALSO
mailq(1), sendmail(8)


praliases

title: praliases(8)

summary: display system mail aliases

text:
# praliases(8)

## NAME
praliases - display system mail aliases

## SYNOPSIS
praliases [-C file] [-f file] [key ...]

## DESCRIPTION
The praliases utility displays the current system aliases, one per line, in no particular order. The special internal @:@ alias will be displayed if present.

The options are as follows:

-C file

Read the specified sendmail configuration file instead of the default sendmail configuration file.

-f file

Read the specified file instead of the configured sendmail system aliases file(s).

If one or more keys are specified on the command line, only entries which match those keys are displayed.

The praliases utility exits 0 on success, and >0 if an error occurs.

## FILES
/etc/mail/sendmail.cf

The default sendmail configuration file.

## SEE ALSO
mailq(1), sendmail(8)


rmail

title: rmail(8)

summary: handle remote mail received via uucp

text:
# rmail(8)

## NAME
rmail - handle remote mail received via uucp

## SYNOPSIS
rmail [-D domain] [-T] user ...

## DESCRIPTION
Rmail interprets incoming mail received via uucp(1), collapsing ``From'' lines in the form generated by mail.local(8) into a single line of the form ``return-path!sender'', and passing the processed mail on to sendmail(8).

Rmail is explicitly designed for use with uucp and sendmail.

### Flags
-D

Use the specified domain instead of the default domain of ``UUCP''.

-T

Turn on debugging.

## SEE ALSO
uucp(1), mail.local(8), sendmail(8)

## HISTORY
The rmail program appeared in 4.2BSD.

## BUGS
Rmail should not reside in /bin.


sendmail

title: sendmail(8)

summary: an electronic mail transport agent

text:
# sendmail(8)

## NAME
sendmail - an electronic mail transport agent

## SYNOPSIS
sendmail [flags] [address ...]

newaliases

mailq [-v]

hoststat

purgestat

smtpd

## DESCRIPTION
Sendmail sends a message to one or more recipients, routing the message over whatever networks are necessary. Sendmail does internetwork forwarding as necessary to deliver the message to the correct place.

Sendmail is not intended as a user interface routine; other programs provide user-friendly front ends; sendmail is used only to deliver pre-formatted messages.

With no flags, sendmail reads its standard input up to an end-of-file or a line consisting only of a single dot and sends a copy of the message found there to all of the addresses listed. It determines the network(s) to use based on the syntax and contents of the addresses.

Local addresses are looked up in a file and aliased appropriately. Aliasing can be prevented by preceding the address with a backslash. Beginning with 8.10, the sender is included in any alias expansions, e.g., if `john' sends to `group', and `group' includes `john' in the expansion, then the letter will also be delivered to `john'.

### Parameters
-Ac

Use submit.cf even if the operation mode does not indicate an initial mail submission.

-Am

Use sendmail.cf even if the operation mode indicates an initial mail submission.

-Btype

Set the body type to type. Current legal values are 7BIT or 8BITMIME.

-ba

Go into ARPANET mode. All input lines must end with a CRLF, and all messages will be generated with a CRLF at the end. Also, the ``From:'' and ``Sender:'' fields are examined for the name of the sender.

-bC

Check the configuration file.

-bd

Run as a daemon. Sendmail will fork and run in background listening on socket 25 for incoming SMTP connections. This is normally run from /etc/rc.

-bD

Same as -bd except runs in foreground.

-bh

Print the persistent host status database.

-bH

Purge expired entries from the persistent host status database.

-bi

Initialize the alias database.

-bm

Deliver mail in the usual way (default).

-bp

Print a listing of the queue(s).

-bP

Print number of entries in the queue(s); only available with shared memory support.

-bs

Use the SMTP protocol as described in RFC821 on standard input and output. This flag implies all the operations of the -ba flag that are compatible with SMTP.

-bt

Run in address test mode. This mode reads addresses and shows the steps in parsing; it is used for debugging configuration tables.

-bv

Verify names only - do not try to collect or deliver a message. Verify mode is normally used for validating users or mailing lists.

-Cfile

Use alternate configuration file. Sendmail gives up any enhanced (set-user-ID or set-group-ID) privileges if an alternate configuration file is specified.

-D logfile

Send debugging output to the indicated log file instead of stdout.

-dcategory.level...

Set the debugging flag for category to level. Category is either an integer or a name specifying the topic, and level an integer specifying the level of debugging output desired. Higher levels generally mean more output. More than one flag can be specified by separating them with commas. A list of numeric debugging categories can be found in the TRACEFLAGS file in the sendmail source distribution.

The option -d0.1 prints the version of sendmail and the options it was compiled with.

Most other categories are only useful with, and documented in, sendmail's source code.

-Ffullname

Set the full name of the sender.

-fname

Sets the name of the ``from'' person (i.e., the envelope sender of the mail). This address may also be used in the From: header if that header is missing during initial submission. The envelope sender address is used as the recipient for delivery status notifications and may also appear in a Return-Path: header. -f should only be used by ``trusted'' users (normally root, daemon, and network) or if the person you are trying to become is the same as the person you are. Otherwise, an X-Authentication-Warning header will be added to the message.

-G

Relay (gateway) submission of a message, e.g., when rmail calls sendmail .

-hN

Set the hop count to N. The hop count is incremented every time the mail is processed. When it reaches a limit, the mail is returned with an error message, the victim of an aliasing loop. If not specified, ``Received:'' lines in the message are counted.

-i

Do not strip a leading dot from lines in incoming messages, and do not treat a dot on a line by itself as the end of an incoming message. This should be set if you are reading data from a file.

-L tag

Set the identifier used in syslog messages to the supplied tag.

-N dsn

Set delivery status notification conditions to dsn, which can be `never' for no notifications or a comma separated list of the values `failure' to be notified if delivery failed, `delay' to be notified if delivery is delayed, and `success' to be notified when the message is successfully delivered.

-n

Don't do aliasing.

-O option=value

Set option option to the specified value. This form uses long names. See below for more details.

-ox value

Set option x to the specified value. This form uses single character names only. The short names are not described in this manual page; see the Sendmail Installation and Operation Guide for details.

-pprotocol

Set the name of the protocol used to receive the message. This can be a simple protocol name such as ``UUCP'' or a protocol and hostname, such as ``UUCP:ucbvax''.

-q[time]

Process saved messages in the queue at given intervals. If time is omitted, process the queue once. Time is given as a tagged number, with `s' being seconds, `m' being minutes (default), `h' being hours, `d' being days, and `w' being weeks. For example, `-q1h30m' or `-q90m' would both set the timeout to one hour thirty minutes. By default, sendmail will run in the background. This option can be used safely with -bd.

-qp[time]

Similar to -qtime, except that instead of periodically forking a child to process the queue, sendmail forks a single persistent child for each queue that alternates between processing the queue and sleeping. The sleep time is given as the argument; it defaults to 1 second. The process will always sleep at least 5 seconds if the queue was empty in the previous queue run.

-qf

Process saved messages in the queue once and do not fork(), but run in the foreground.

-qGname

Process jobs in queue group called name only.

-q[!]Isubstr

Limit processed jobs to those containing substr as a substring of the queue id or not when ! is specified.

-q[!]Qsubstr

Limit processed jobs to quarantined jobs containing substr as a substring of the quarantine reason or not when ! is specified.

-q[!]Rsubstr

Limit processed jobs to those containing substr as a substring of one of the recipients or not when ! is specified.

-q[!]Ssubstr

Limit processed jobs to those containing substr as a substring of the sender or not when ! is specified.

-Q[reason]

Quarantine a normal queue items with the given reason or unquarantine quarantined queue items if no reason is given. This should only be used with some sort of item matching using as described above.

-R return

Set the amount of the message to be returned if the message bounces. The return parameter can be `full' to return the entire message or `hdrs' to return only the headers. In the latter case also local bounces return only the headers.

-rname

An alternate and obsolete form of the -f flag.

-t

Read message for recipients. To:, Cc:, and Bcc: lines will be scanned for recipient addresses. The Bcc: line will be deleted before transmission.

-U

If a mail submission via the command line requires the use of the SMTPUTF8 argument for the MAIL command, e.g., because a header uses UTF-8 encoding, but the addresses on the command line are all ASCII, then this option must be used. Only available if EAI support is enabled, and the SMTPUTF8 option is set.

-V envid

Set the original envelope id. This is propagated across SMTP to servers that support DSNs and is returned in DSN-compliant error messages.

-v

Go into verbose mode. Alias expansions will be announced, etc.

-X logfile

Log all traffic in and out of mailers in the indicated log file. This should only be used as a last resort for debugging mailer bugs. It will log a lot of data very quickly.

--

Stop processing command flags and use the rest of the arguments as addresses.

### Options
There are also a number of processing options that may be set. Normally these will only be used by a system administrator. Options may be set either on the command line using the -o flag (for short names), the -O flag (for long names), or in the configuration file. This is a partial list limited to those options that are likely to be useful on the command line and only shows the long names; for a complete list (and details), consult the Sendmail Installation and Operation Guide. The options are:

AliasFile=file

Use alternate alias file.

HoldExpensive

On mailers that are considered ``expensive'' to connect to, don't initiate immediate connection. This requires queueing.

CheckpointInterval=N

Checkpoint the queue file after every N successful deliveries (default 10). This avoids excessive duplicate deliveries when sending to long mailing lists interrupted by system crashes.

DeliveryMode=x

Set the delivery mode to x. Delivery modes are `i' for interactive (synchronous) delivery, `b' for background (asynchronous) delivery, `q' for queue only - i.e., actual delivery is done the next time the queue is run, and `d' for deferred - the same as `q' except that database lookups for maps which have set the -D option (default for the host map) are avoided.

ErrorMode=x

Set error processing to mode x. Valid modes are `m' to mail back the error message, `w' to ``write'' back the error message (or mail it back if the sender is not logged in), `p' to print the errors on the terminal (default), `q' to throw away error messages (only exit status is returned), and `e' to do special processing for the BerkNet. If the text of the message is not mailed back by modes `m' or `w' and if the sender is local to this machine, a copy of the message is appended to the file dead.letter in the sender's home directory.

SaveFromLine

Save UNIX-style From lines at the front of messages.

MaxHopCount=N

The maximum number of times a message is allowed to ``hop'' before we decide it is in a loop.

IgnoreDots

Do not take dots on a line by themselves as a message terminator.

SendMimeErrors

Send error messages in MIME format. If not set, the DSN (Delivery Status Notification) SMTP extension is disabled.

ConnectionCacheTimeout=timeout

Set connection cache timeout.

ConnectionCacheSize=N

Set connection cache size.

LogLevel=n

The log level.

MeToo=False

Don't send to ``me'' (the sender) if I am in an alias expansion.

CheckAliases

Validate the right hand side of aliases during a newaliases(1) command.

OldStyleHeaders

If set, this message may have old style headers. If not set, this message is guaranteed to have new style headers (i.e., commas instead of spaces between addresses). If set, an adaptive algorithm is used that will correctly determine the header format in most cases.

QueueDirectory=queuedir

Select the directory in which to queue messages.

StatusFile=file

Save statistics in the named file.

Timeout.queuereturn=time

Set the timeout on undelivered messages in the queue to the specified time. After delivery has failed (e.g., because of a host being down) for this amount of time, failed messages will be returned to the sender. The default is five days.

UserDatabaseSpec=userdatabase

If set, a user database is consulted to get forwarding information. You can consider this an adjunct to the aliasing mechanism, except that the database is intended to be distributed; aliases are local to a particular host. This may not be available if your sendmail does not have the USERDB option compiled in.

ForkEachJob

Fork each job during queue runs. May be convenient on memory-poor machines.

SevenBitInput

Strip incoming messages to seven bits.

EightBitMode=mode

Set the handling of eight bit input to seven bit destinations to mode: m (mimefy) will convert to seven-bit MIME format, p (pass) will pass it as eight bits (but violates protocols), and s (strict) will bounce the message.

MinQueueAge=timeout

Sets how long a job must ferment in the queue between attempts to send it.

DefaultCharSet=charset

Sets the default character set used to label 8-bit data that is not otherwise labelled.

NoRecipientAction=action

Set the behaviour when there are no recipient headers (To:, Cc: or Bcc:) in the message to action: none leaves the message unchanged, add-to adds a To: header with the envelope recipients, add-apparently-to adds an Apparently-To: header with the envelope recipients, add-bcc adds an empty Bcc: header, and add-to-undisclosed adds a header reading `To: undisclosed-recipients:;'.

MaxDaemonChildren=N

Sets the maximum number of children that an incoming SMTP daemon will allow to spawn at any time to N.

ConnectionRateThrottle=N

Sets the maximum number of connections per second to the SMTP port to N.

In aliases, the first character of a name may be a vertical bar to cause interpretation of the rest of the name as a command to pipe the mail to. It may be necessary to quote the name to keep sendmail from suppressing the blanks from between arguments. For example, a common alias is:

msgs: "|/usr/bin/msgs -s"

Aliases may also have the syntax ``:include:filename'' to ask sendmail to read the named file for a list of recipients. For example, an alias such as:

poets: ":include:/usr/local/lib/poets.list"

would read /usr/local/lib/poets.list for the list of addresses making up the group.

Sendmail returns an exit status describing what it did. The codes are defined in <sysexits.h>:

EX_OK

Successful completion on all addresses.

EX_NOUSER

User name not recognized.

EX_UNAVAILABLE

Catchall meaning necessary resources were not available.

EX_SYNTAX

Syntax error in address.

EX_SOFTWARE

Internal software error, including bad arguments.

EX_OSERR

Temporary operating system error, such as ``cannot fork''.

EX_NOHOST

Host name not recognized.

EX_TEMPFAIL

Message could not be sent immediately, but was queued.

If invoked as newaliases, sendmail will rebuild the alias database. If invoked as mailq, sendmail will print the contents of the mail queue. If invoked as hoststat, sendmail will print the persistent host status database. If invoked as purgestat, sendmail will purge expired entries from the persistent host status database. If invoked as smtpd, sendmail will act as a daemon, as if the -bd option were specified.

## NOTES
sendmail often gets blamed for many problems that are actually the result of other problems, such as overly permissive modes on directories. For this reason, sendmail checks the modes on system directories and files to determine if they can be trusted. Although these checks can be turned off and your system security reduced by setting the DontBlameSendmail option, the permission problems should be fixed. For more information, see the Sendmail Installation and Operation Guide

## FILES
Except for the file /etc/mail/sendmail.cf itself the following pathnames are all specified in /etc/mail/sendmail.cf. Thus, these values are only approximations.

/etc/mail/aliases

raw data for alias names

/etc/mail/aliases.db

data base of alias names

/etc/mail/sendmail.cf

configuration file

/etc/mail/helpfile

help file

/etc/mail/statistics

collected statistics

/var/spool/mqueue/*

temp files

## SEE ALSO
binmail(1), mail(1), rmail(1), syslog(3), aliases(5), mailaddr(7), rc(8)

DARPA Internet Request For Comments RFC819, RFC821, RFC822. Sendmail Installation and Operation Guide, No. 8, SMM.

http://www.sendmail.org/

US Patent Numbers 6865671, 6986037.

## HISTORY
The sendmail command appeared in 4.2BSD.


smrsh

title: smrsh(8)

summary: restricted shell for sendmail

text:
# smrsh(8)

## NAME
smrsh - restricted shell for sendmail

## SYNOPSIS
smrsh -c command

## DESCRIPTION
The smrsh program is intended as a replacement for sh for use in the ``prog'' mailer in sendmail(8) configuration files. It sharply limits the commands that can be run using the ``|program'' syntax of sendmail in order to improve the over all security of your system. Briefly, even if a ``bad guy'' can get sendmail to run a program without going through an alias or forward file, smrsh limits the set of programs that he or she can execute.

Briefly, smrsh limits programs to be in a single directory, by default /etc/smrsh, allowing the system administrator to choose the set of acceptable commands, and to the shell builtin commands ``exec'', ``exit'', and ``echo''. It also rejects any commands with the characters ``', `<', `>', `;', `$', `(', `)', `\r' (carriage return), or `\n' (newline) on the command line to prevent ``end run'' attacks. It allows ``||'' and ``&&'' to enable commands like: ``"|exec /usr/local/bin/filter || exit 75"''

Initial pathnames on programs are stripped, so forwarding to ``/usr/sbin/vacation'', ``/usr/bin/vacation'', ``/home/server/mydir/bin/vacation'', and ``vacation'' all actually forward to ``/etc/smrsh/vacation''.

System administrators should be conservative about populating the sm.bin directory. For example, a reasonable additions is vacation(1), and the like. No matter how brow-beaten you may be, never include any shell or shell-like program (such as perl(1)) in the sm.bin directory. Note that this does not restrict the use of shell or perl scripts in the sm.bin directory (using the ``#!'' syntax); it simply disallows execution of arbitrary programs. Also, including mail filtering programs such as procmail(1) is a very bad idea. procmail(1) allows users to run arbitrary programs in their procmailrc(5).

## COMPILATION
Compilation should be trivial on most systems. You may need to use -DSMRSH_PATH=\"path\" to adjust the default search path (defaults to ``/bin:/usr/bin:/usr/ucb'') and/or -DSMRSH_CMDDIR=\"dir\" to change the default program directory (defaults to ``/etc/smrsh'').

## FILES
/etc/smrsh - default directory for restricted programs on most OSs

/var/adm/sm.bin - directory for restricted programs on HP UX and Solaris

/usr/libexec/sm.bin - directory for restricted programs on FreeBSD (>= 3.3) and DragonFly BSD

## SEE ALSO
sendmail(8)


title: ser2net(8)

summary: Serial to network proxy

text:
# ser2net(8)

## NAME
ser2net - Serial to network proxy

## SYNOPSIS
ser2net [-c configfile] [-C configline] [-p controlport] [-n] [-d] [-b] [-v] [-P pidfile]

## DESCRIPTION
The ser2net daemon allows telnet and tcp sessions to be established with a unit's serial ports.

The program comes up normally as a daemon, opens the TCP ports specified in the configuration file, and waits for connections. Once a connection occurs, the program attempts to set up the connection and open the serial port. If another user is already using the connection or serial port, the connection is refused with an error message.

## OPTIONS
-c config-file

Set the configuration file to one other than the default of /etc/ser2net.conf

-C config-line

Handle a single configuration line. This may be specified multiple times for multiple lines. This is just like a line in the config file. This disables the default config file, you must specify a -c after the last -C to have it read a config file, too.

-n

Stops the daemon from forking and detaching from the controlling terminal. This is useful for running from init.

-d

Like -n, but also sends the system logs to standard output. This is most useful for debugging purposes.

-P pidfile

If specified, put the process id (pid) of ser2net in the pidfile, replacing whatever was in that file previously. A pidfile is not created by default, you must specify this to create one. Note also that this filename must be specific with the full path, as ser2net will change directory to "/" when it becomes a daemon. when it

-u

If UUCP locking is enabled, this will disable the use of UUCP locks.

-b

Cisco IOS uses a different mechanism for specifying the baud rates than the mechanism described in RFC2217. This option sets the IOS version of setting the baud rates. The default is RFC2217's.

-v

Prints the version of the program and exits.

-p controlport

Enables the control port and sets the TCP port to listen to for the control port. A port number may be of the form [host,]port, such as 127.0.0.1,2000 or localhost,2000. If this is specified, it will only bind to the IP address specified for the port. Otherwise, it will bind to all the addresses on the machine. If the port number is zero, that means that standard in/out will be used for the only input/output, and only one port should be specified in the config. This way, it can be used from inetd.

## CONTROL PORT
The control port provides a simple interface for controlling the ports and viewing their status. To accomplish this, it has the following commands:

showport [<TCP port>]

Show information about a port. If no port is given, all ports are displayed.

showshortport [<TCP port>]

Show information about a port, each port on one line. If no port is given, all ports are displayed. This can produce very wide output.

help

Display a short list and summary of commands.

exit

Disconnect from the control port.

version

Display the version of this program.

monitor <type> <tcp port>

Display all the input for a given port on the calling control port. Only one direction may be monitored at a time. The type field may be tcp or term and specifies whether to monitor data from the TCP port or from the serial port Note that data monitoring is best effort, if the controller port cannot keep up the data will be silently dropped. A controller may only monitor one thing and a port may only be monitored by one controller.

monitor stop

Stop the current monitor.

disconnect <tcp port>

Disconnect the tcp connection on the port.

setporttimeout <tcp port> <timeout>

Set the amount of time in seconds before the port connection will be shut down if no activity has been seen on the port.

setportconfig <tcp port> <config>

Set the port configuration as in the device configuration in the /etc/ser2net.conf file. If conflicting options are specified, the last option will be the one used. Note that these will not change until the port is disconnected and connected again. Options 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 set the various baud rates. EVEN, ODD, NONE set the parity. 1STOPBIT, 2STOPBITS set the number of stop bits. 7DATABITS, 8DATABITS set the number of data bits. [-]XONXOFF turns on (- off) XON/XOFF support. [-]RTSCTS turns on (- off) hardware flow control. [-]LOCAL ignores (- checks) the modem control lines (DCD, DTR, etc.)

setportcontrol <tcp port> <controls>

Modify dynamic port controls. These do not stay between connections. Controls are: DTRHI, DTRLO Turns on and off the DTR line. RTSHI, RTSLO Turns on and off the RTS line.

setportenable <tcp port> <enable state>

Sets the port operation state. Valid states are: off to shut the TCP port down, raw to enable the TCP port transfer all I/O as-is, rawlp to enable the TCP port input and device output without termios setting, and telnet to enable the TCP port is up run the telnet negotiation protocol on the port.

## CONFIGURATION
Configuration is accomplished through the file /etc/ser2net.conf. A file with another name or path may be specified using the -c option, or individual config lines may be specified with the -C option. This file consists of one or more entries with the following format:

<TCP port>:<state>:<timeout>:<device>:<options>

or

BANNER:<banner name>:<banner text>

### FIELDS
TCP port

Name or number of the TCP/IP port to accept connections from for this device. A port number may be of the form [host,]port, such as 127.0.0.1,2000 or localhost,2000. If this is specified, it will only bind to the IP address specified for the port. Otherwise, it will bind to all the ports on the machine.

state

Either raw or rawlp or telnet or off. off disables the port from accepting connections. It can be turned on later from the control port. raw enables the port and transfers all data as-is between the port and the long. rawlp enables the port and transfers all input data to device, device is open without any termios setting. It allow to use /dev/lpX devices and printers connected to them. telnet enables the port and runs the telnet protocol on the port to set up telnet parameters. This is most useful for using telnet.

timeout

The time (in seconds) before the port will be disconnected if there is no activity on it. A zero value disables this funciton.

device

The name of the device to connect to. This must be in the form of /dev/<device>.

device configuration options

Sets operational parameters for the serial port. Values may be separated by spaces or commas. Options 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 set the various baud rates. EVEN, ODD, NONE set the parity. 1STOPBIT, 2STOPBITS set the number of stop bits. 7DATABITS, 8DATABITS set the number of data bits. [-]XONXOFF turns on (- off) XON/XOFF support. [-]RTSCTS turns on (- off) hardware flow control. [-]LOCAL ignores (- checks) the modem control lines (DCD, DTR, etc.) [-]HANGUP_WHEN_DONE lowers (- does not lower) the modem control lines (DCD, DTR, etc.) when the connection closes. NOBREAK Disables automatic clearing of the break setting of the port. remctl allows remote control of the serial port parameters via RFC 2217. See the README for more info. <banner name> displays the given banner when a user connects to the port.

banner name

A name for the banner; this may be used in the options of a port.

banner text

The text to display as the banner. This may contain normal "C" escape strings, and it may also contain, \d for the device name, \p for the TCP port number, and \s for the serial port parameters (eg 9600N81) of the given connection.

Blank lines and lines starting with `#' are ignored.

## SECURITY
ser2net uses the tcp wrappers interface to implement host-based security. See hosts_access(5) for a description of the file setup. Two daemons are used by ser2net, "ser2net" is for the data ports and "ser2net-control" is for the control ports.

## SIGNALS
SIGHUP

If ser2net receives a SIGHUP, it will reread it configuration file and make the appropriate changes. If an inuse port is changed or deleted, the actual change will not occur until the port is disconnected.

## Error
Almost all error output goes to syslog, not standard output.

## FILES
/etc/ser2net.conf

## SEE ALSO
telnet(1), hosts_access(5)

## KNOWN PROBLEMS
None.

## AUTHOR
Corey Minyard <minyard@acm.org>


sercd

package: sercd

title: sercd(8)

summary: RFC 2217 Serial Communications Daemon

text:
# sercd(8)

## NAME
sercd - RFC 2217 Serial Communications Daemon

## SYNOPSIS
sercd [-ie] [-p port] [-l addr] <loglevel> <device> <lockfile> [pollingterval]

## DESCRIPTION
This manual page documents briefly the sercd, program.

This program when run through inetd will use the RFC 2217 extensions to TELNET to implement serial commands over the TCP connection and interface to a specified serial port.

## OPTIONS
-i

Enable compatability with Cisco IOS.

-e

Send output to standard error instead of syslog.

-p port

Listen on specified port, instead of port 7000.

-l addr

Standalone mode, bind to specified adress, empty string for all.

The first mandatory parameter is the log level for use in syslog. The next mandatory parameter is the device node for the serial device, it must be a fully qualified path. The final mandatory parameter is the file name for the lock file to be used to prevent multiple instances of sercd from talking to the serial port at the same time, or to allow sharing a port between modem and sercd.

## EXAMPLE
Here is a configuration line for running it from inetd: sredir stream tcp nowait root /usr/sbin/tcpd /usr/sbin/sercd 5 /dev/modem /var/lock/LCK..modem

## AUTHOR
This man page was written by Peter Åstrand <astrand@cendio.se>.

The sercd program is based on sredird, which was written by Denis Sbragion <d.sbragion@infotecna.it> and Jeffrey Altman <jaltman@columbia.edu>.


limited

package: service

title: limited(8)

summary: run program with limited resources

text:
# limited(8)

## NAME
limited - run program with limited resources

## SYNOPSIS
limited [options] [--] [command [arg]...]

## DESCRIPTION
limited - run program with limited resources.

## OPTIONS
-n, --name=NAME

apply limits configured for this program name;

-V, --version

print program version and exit;

-h, --help

show this text and exit.

## FILES
/etc/sysconfig/limits - systemwide limits for all programs; uses shell syntax.

/etc/sysconfig/limits.d/NAME

- limits for NAME program, override systemwide limits; uses shell syntax.

## AUTHOR
Written by Alexey Gladkov <legion@altlinux.org>

## REPORTING BUGS
Report bugs to http://bugzilla.altlinux.org/

## COPYRIGHT
Copyright © 2008-2009 Alexey Gladkov <legion@altlinux.org>

Copyright © 2008 Dmitry V. Levin <ldv@altlinux.org>

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## SEE ALSO
nice(1), ionice(1), getrlimit(2).


service

title: service(8)

summary: run a System V init script

text:
# service(8)

## NAME
service - run a System V init script

## SYNOPSIS
service SCRIPT COMMAND [OPTIONS]

service --help | -h | --version

## DESCRIPTION
service runs a System V init script with current working directory set to /.

The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT. The supported values of COMMAND depend on the invoked script, service passes COMMAND and OPTIONS it to the init script unmodified. All scripts should support at least the start and stop commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start command.

## FILES
/etc/init.d

The directory containing System V init scripts.

## SEE ALSO
chkconfig(8)


start-stop-daemon

title: start-stop-daemon(8)

summary: start and stop system daemon programs

text:
# start-stop-daemon(8)

## NAME
start-stop-daemon - start and stop system daemon programs

## SYNOPSIS
start-stop-daemon -S|--start options [--] arguments

start-stop-daemon -K|--stop options

start-stop-daemon -H|--help

start-stop-daemon -V|--version

## DESCRIPTION
start-stop-daemon is used to control the creation and termination of system-level processes. Using the --exec, --pidfile, --user, and --name options, start-stop-daemon can be configured to find existing instances of a running process.

With --start, start-stop-daemon checks for the existence of a specified process. If such a process exists, start-stop-daemon does nothing, and exits with error status 1 (0 if --oknodo is specified). If such a process does not exist, it starts an instance, using either the executable specified by --exec, (or, if specified, by --startas). Any arguments given after -- on the command line are passed unmodified to the program being started. If --retry is specified then start-stop-daemon will check that the process(es) have terminated.

With --stop, start-stop-daemon also checks for the existence of a specified process. If such a process exists, start-stop-daemon sends it the signal specified by --signal, and exits with error status 0. If such a process does not exist, start-stop-daemon exits with error status 1 (0 if --oknodo is specified).

## OPTIONS
-x|--exec executable

Check for processes that are instances of this executable (according to /proc/pid/exe ).

-p|--pidfile pid-file

Check for processes whose process-id is specified in pid-file.

-u|--user username|uid

Check for processes owned by the user specified by username or uid.

-n|--name process-name

Check for processes with the name process-name (according to /proc/pid/stat).

-s|--signal signal

With --stop, specifies the signal to send to processes being stopped (default 15).

-R|--retry timeout|schedule

With --stop, specifies that start-stop-daemon is to check whether the process(es) do finish. It will check repeatedly whether any matching processes are running, until none are. If the processes do not exit it will then take further action as determined by the schedule. If timeout is specified instead of schedule then the schedule signal/timeout/KILL/timeout is used, where signal is the signal specified with --signal.

schedule is a list of at least two items separated by slashes (/); each item may be -signal-number or [-]signal-name, which means to send that signal, or timeout, which means to wait that many seconds for processes to exit, or forever, which means to repeat the rest of the schedule forever if necessary.

If the end of the schedule is reached and forever is not specified, then start-stop-daemon exits with error status 2. If a schedule is specified, then any signal specified with --signal is ignored.

-a|--startas pathname

With --start, start the process specified by pathname. If not specified, defaults to the argument given to --exec.

-t|--test

Print actions that would be taken and set appropriate return value, but take no action.

-o|--oknodo

Return exit status 0 instead of 1 if no actions are (would be) taken.

-q|--quiet

Do not print informational messages; only display error messages.

-c, --chuid username|uid

Change to this username/uid before starting the process. You can also specify a group by appending a :, then the group or gid in the same way as you would for the `chown' command (user:group). If a user is specified without a group, the primary GID for that user is used. When using this option you must realize that the primary and supplemental groups are set as well, even if the --group option is not specified. The --group option is only for groups that the user isn't normally a member of (like adding per process group membership for generic users like nobody).

-g, --group group|gid

Change to group or gid when starting the process.

-r|--chroot root

Chdir and chroot to root before starting the process. Please note that the pidfile is also written after the chroot.

-b|--background

Typically used with programs that don't detach on their own. This option will force start-stop-daemon to fork before starting the process, and force it into the background. WARNING: start-stop-daemon cannot check the exit status if the process fails to execute for any reason. This is a last resort, and is only meant for programs that either make no sense forking on their own, or where it's not feasible to add the code for it to do this itself.

-N|--nicelevel

This alters the prority of the process before starting it.

-m|--make-pidfile

Used when starting a program that does not create its own pid file. This option will make start-stop-daemon create the file referenced with --pidfile and place the pid into it just before executing the process. Note, it will not be removed when stopping the program. NOTE: This feature may not work in all cases. Most notably when the program being executed forks from its main process. Because of this it is usually only useful when combined with the --background option.

-v|--verbose

Print verbose informational messages.

-H|--help

Print help information; then exit.

-V|--version

Print version information; then exit.

## AUTHORS
Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl> based on a previous version by Ian Jackson <ian@chiark.greenend.org.uk>.

Adopted for ALT Linux by Dmitry V. Levin <ldv@altlinux.org>.

Manual page by Klee Dienes <klee@mit.edu>, partially reformatted by Ian Jackson.