DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

tcpio(1)


tcpio -- trusted import/export archiving

Synopsis

tcpio -o[aLvVx] [-C bufsize] [-M message] -O output-file
[-X low_level,high_level]
tcpio -i [bdfkPrsStuvVx] [-C bufsize] [-E file] -I file [-M message]
[-N level] [-nnum] [-R ID] [-T file]
[-X low_level,high_level] [pattern . . .]

Description

The -i and -o options select the action to be performed. The following list describes each of the actions (which are mutually exclusive).

tcpio -o
(copy out) reads the standard input to obtain a list of pathnames and copies those files, together with pathname and status information, onto the file or device specified with the -O option. The data is preceded by MAC and DAC security-related information saved to enable validation of the data when it is read back in. For executable files, file privileges (if any) are also saved.

tcpio -i
(copy in) extracts files from the archive file or device specified by the -I option, which is assumed to be the product of a previous tcpio -o. Only files with names that match patterns are selected. patternss are regular expressions given in the filename-generating notation of sh(1). In patterns, meta-characters ``?'', ``*'', and [ . . . ] match the slash (``/'') character, and backslash (``\'') is an escape character. A ``!'' meta-character means not. (For example, the !abc* pattern would exclude all files that begin with ``abc''.) Multiple patterns may be specified and if no patterns are specified, the default for patterns is ``*'' (that is, select all files). When tcpio is invoked from the shell, each pattern should be quoted; otherwise the pattern may be expanded.

Extracted files are conditionally created based upon the options described below.

Before a file is extracted, the user, group, classification, category and level identifiers (IDs) it references are validated. If any of the identifiers has been deleted from the system, or changed in any way (and is not remapped to a valid identifier), the file will not be extracted.

For users without privileges, the permissions of the files will be the same as those at the time of the previous tcpio -o except the bits set in the user's umask will be cleared. The owner and group of these files will be those of the current user. For users with the appropriate privileges, the permissions, owner, and group of the files will be the same as those at the time of the previous tcpio -o.

The modification time and access time of a restored file is set to the modification time of the file when it was backed up. In the case of regular directories and MLDs, modification time and access time are updated to the current time as files are restored within the directory.

Executable files which have privileges when they were backed up are restored without privileges. The privileges associated with the file when it was backed up can be displayed using the -t or -v options. It is up to the administrator to assign appropriate privileges to the restored files.


NOTE: If tcpio -i tries to create a file that already exists and the existing file is the same age or newer, tcpio will output a warning message and not replace the file.

(The -u option can be used to overwrite the existing file unconditionally.)

The meanings of the available options are


-a
Reset access times of input files after they have been copied.

-b
Reverse the order of the bytes within each word.

-C bufsize
Input/output is to be blocked bufsize bytes to the record, where bufsize is replaced by a positive integer. The default buffer size is device dependent when this option is not used.

-d
Directories are to be created as needed.

-E file
Specify an input file (file) that contains a list of filenames to be extracted from the archive (one filename per line).

-f
Copy in all files except those in patterns. (See the paragraph on tcpio -i for a description of patterns.)

-I file
Read the contents of file as input. If file is a character special device, when the first medium is full replace the medium and press <Return> to continue to the next medium.

-k
Attempt to skip corrupted file headers and I/O errors that may be encountered. If you want to copy files from a medium that is corrupted or out of sequence, this option lets you read only those files with good headers. (For tcpio archives that contain other tcpio archives, if an error is encountered tcpio may terminate prematurely. tcpio will find the next good header, which may be one for a smaller archive, and terminate when the smaller archive's trailer is encountered.)

-L
Follow symbolic links. The default is not to follow symbolic links.


NOTE: When tcpio is used in conjunction with find, if the -L option is used with tcpio then the -follow option must be used with find. Otherwise, undesirable results will occur.


-M message
Define a message to use when switching media. When you use the -O or -I options and specify a character special device, you can use this option to define the message that is printed when you reach the end of the medium. One %d can be placed in message to print the sequence number of the next medium needed to continue.

-nnum
Disable the validation of one or more identifiers (type or item). The permissible values of num are:

1
Disable comparison of original system name to the current system.

2
Disable all checks of UIDs.

3
Disable all checks of GIDs.

4
Disable all checks of LID existence.

5
Disable all checks of LID state (LIDs must be valid, but can be in the inactive state).

Any combination of the above is valid. For example, -n2 -n3 would disable the checks of UIDs and GIDs.


-N level
Extract all files and assign them the MAC level level. A LID, alias or fully qualified level name may be used to specify level. It must be defined on the system and within the medium level range.

-O file
Direct the output of tcpio to file. If file is a character special device, when the first medium is full replace the medium and press <Return> to continue to the next medium.

-P
Print the level range of an existing archive. No files are created. If -X was not specified when the archive was created, a message is printed stating that the archive range is unbounded.

-r
Interactively rename files. If the user types a null line, the file is skipped. If the user types a ``.'' the original pathname will be copied.

-R ID
Reassign ownership and group information for each file to user ID (ID must be a valid user ID from /etc/passwd). The group ID assigned is the group ID in /etc/passwd associated with the user ID, ID.

-s
Swap bytes within each half word.

-S
Swap halfwords within each word.

-t
Print a table of contents of the input, consisting of names and file privileges (if any). When used with the -v option, privileges are omitted and other file information is displayed. No files are created.

-T file
Use the contents of file to remap invalid identifiers to valid ones. The structure of file (called tcpio table of content translation table or TTOCTT) is as follows (the fields separated by whitespace):

Type Specifier Saved Numeric/Text ID New Numeric/Text ID

The meanings of these fields are as follows:


-u
Copy unconditionally (normally, an older file will not replace a newer file with the same name).

-v
Verbose: causes a list of file names to be printed. When used with the -t option, the table of contents looks like the output of an ls -l command, with each file's level identifier (LID) appended to the other file information [see ls(1)]. Otherwise, for files which had associated privileges on backup, privilege lists are displayed along with file names.

-V
Special Verbose: print a dot for each file seen. Useful to assure the user that tcpio is working without printing out all file names.

-x
Quiet mode. Suppresses the printing of all warning messages.

-X low_level,high_level
Extract only files with MAC level between low_level and high_level, inclusive. high_level must dominate low_level. LIDs, aliases, or fully qualified level names may be used to specify ``low_level'' and ``high_level''. Only valid names or aliases may be used; a LID may be used even if it has been deleted.


NOTE: tcpio assumes four-byte words.

If tcpio reaches end of medium (end of a diskette for example), when writing to (-o) or reading from (-i) a character special device, and -O and -I aren't used, tcpio will print the message:

   If you want to go on, type device/file name when ready.

To continue, you must replace the medium and type the character special device name (/dev/rdiskette for example) and press <Return>. You may want to continue by directing tcpio to use a different device. For example, if you have two floppy drives you may want to switch between them so tcpio can proceed while you are changing the floppies. (Pressing <Return> alone causes the tcpio process to exit.)

Examples

The following examples show some possible ways to use tcpio.

When standard input is directed through a pipe to tcpio -o, files are grouped so they can be directed to a single file (../newfile) specified with the -O option.
(Instead of ls, find(1), echo(1), and cat(1)--could also be used to pipe a list of names to tcpio.) You could direct the output to a device instead of a file.

   ls | tcpio -o -O ../ newfile

tcpio -i uses the output file of tcpio -o (specified with the -I option in the example), extracts those files that match the patterns (memo/a1, memo/b*), creates directories below the current directory as needed (-d option), and places the files in the appropriate directories. If no patterns were given, all files from newfile would be placed in the directory.

   tcpio -idI newfile "memo/a1" "memo/b*"

tcpio -iN Secret extracts all files at level Secret while the -X LessSecret,VerySecret directive imposes a limit on the level of the files extracted. No file with level lower than ``LessSecret'' or higher than ``VerySecret'' will be extracted. The -I option specifies the input device, in this example /dev/tape1. The -d options says to create directories as needed. (It is important to use the -depth option of find(1) to generate pathnames for tcpio. This eliminates problems tcpio could have trying to create files under read-only directories.)

   tcpio -idI /dev/tape1 -N Secret -X LessSecret,VerySecret


NOTE: When you use tcpio in conjunction with find, if you use the -L option with tcpio then you must use the -follow option with find and vice versa. Otherwise there will be undesirable results.

Files


/etc/passwd

/etc/group

/etc/security/mac/lid.internal

/etc/security/mac/hist.lid.del

References

ar(1), archives(4), cat(1), cpio(1), echo(1), find(1), ls(1), rtcpio(1M), tar(1)

Notices

tcpio and cpio archives are incompatible with one another.

Pathnames are restricted to 256 characters for the binary (the default) and -H odc formats; otherwise, pathnames are restricted to 1024 characters.

Only a privileged user can copy special files.

Blocks are reported in 512-byte quantities.

If a file has 000 permissions and contains more than 0 characters of data, and the user does not have appropriate privilege, the file will not be saved or restored.

Prior to Release 4, the default buffer size was 512 bytes. Beginning with Release 4, the default buffer size is optimized for the device and using the -C option to specify a different block size may cause cpio to fail. Therefore, care must be taken when choosing the block size. For example, for floppy disks, bufsize must be a multiple of
512 (one floppy sector). To avoid wasting space on streaming tape drives, use the -C option with an appropriate block size.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004