.TM 78-1273-5 39199 39199-11
.if \n(TN>0 * On internship from Department 9444.
Uucp Implementation Description
.ie \n(TN>0 D. A. Nowitz\s-2\u*\d\s+2
Uucp is a series of programs designed to permit communication
systems using either dial-up or hardwired communication
This document gives a detailed implementation
description of the current (second)
for use by an administrator/installer of the system.
It is not meant as a user's guide.
Uucp is a series of programs designed to permit communication between
systems using either dial-up or
hardwired communication lines.
It is used for file transfers and remote command execution.
The first version of the system was designed and implemented
by M. E. Lesk.\s-2\u1\d\s+2
1 M. E. Lesk and A. S. Cohen,
Software Distribution by Communication Link,
.ie \n(TN>0 TM-77-1274-3, TM-77-8234-5.
.el private communication.
This paper describes the current (second) implementation
Uucp is a batch type operation.
Files are created in a spool directory for processing
There are three types of files used for the execution
contain data for transfer to remote systems.
contain directions for file transfers between systems.
involve the resources of one or more systems.
The uucp system consists of four primary and two
The primary programs are:
This program creates work and gathers data files in the spool directory
for the transmission of files.
This program creates work files, execute files and gathers data files for the remote execution of
This program executes the work files for data transmission.
This program executes the execution files for
The secondary programs are:
This program updates the log file with new entries
and reports on the status of uucp requests.
This program removes old files from the spool directory.
The remainder of this paper will describe the operation
of each program, the installation of the system,
the security aspects of the system,
the files required for execution,
and the administration of the system.
Uucp - UNIX to UNIX File Copy
command is the user's primary interface with the system.
command was designed to look like
\ ...\ \ source\ ...\ \ destination
where the source and destination
which indicates the system on which the file
or where they will be copied.
The options interpreted by
Make directories when necessary for copying the file.
Don't copy source files to the spool directory,
but use the specified source when the actual
in as the grade in the name of the work file.
(This can be used to change the order of work for a particular
Send mail on completion of the work.
The following options are used primarily for debugging:
Queue the job but do not start
is the level of debugging output desired.
The destination may be a directory name,
in which case the file name is taken from the last part of the
name may contain special shell characters
If a source argument has a
prefix for a remote system,
the file name expansion will be done on the remote system.
uucp\ \ *.c\ \ usg!/usr/dan
will set up the transfer of all files whose names end with ``.c''
to the ``/usr/dan'' directory on the``usg'' machine.
The source and/or destination names may also contain a
This translates to the login directory on
For names with partial path-names,
the current directory is prepended to the file name.
uucp\ \ usg!~dan/*.h\ \ ~dan
will set up the transfer of files whose names end with ``.h''
directory on system ``usg'' to dan's local
the program will check the source and destination
and the system-part of each to
classify the work into one of five types:
Copy source to destination on local system.
Receive files from other systems.
Send files to a remote systems.
Send files from remote systems
to another remote system.
Receive files from remote systems when the source
contains special shell characters as
After the work has been set up in the spool directory,
program is started to try to contact the other
machine to execute the work (unless the \-r option
command is used to do the work.
options are not honored in this case.
is created for each file requested and put in the spool directory
with the following fields, each separated by a blank.
use a blank as the field separator.)
The full path-name of the source or a ~user/path-name.
part will be expanded on the remote system.
The full path-name of the destination file.
notation is used, it will be immediately
expanded to be the login directory for the user.
A ``\-'' followed by an option list.
(Only the \-m and \-d options will appear in this list.)
is created and the source file is copied into a
In this case, the file will be transmitted from
The fields of each entry are given below.
The full-path name of the source file.
The full-path name of the destination or
A ``\-'' followed by an option list.
The file mode bits of the source file
command and sends it to the remote machine;
Uux - UNIX To UNIX Execution
command is used to set up the execution of a
where the execution machine and/or some of the
The syntax of the uux command is
where the command-string is made up of one or more arguments.
All special shell characters such as ``<>|^'' must be quoted
either by quoting the entire command-string
or quoting the character as a separate argument.
Within the command-string, the command and file names may
All arguments which do not contain a ``!'' will not
(They will not be copied to the execution machine.)
The ``\-'' is used to indicate that the standard input
should be inherited from the standard input
The options, essentially for debugging, are:
Num is the level of debugging output desired.
pr\ \ abc\ \ |\ \ uux\ \ \-\ \ usg!lpr
will set up the output of ``pr abc''
as standard input to an lpr command
to be executed on system ``usg''.
names of the files required
for execution (including standard input),
the user's login name, the destination
of the standard output, and the command to be executed.
This file is either put in the spool directory
for local execution or sent to the remote system using
a generated send command (type 3 above).
For required files which are not on the execution machine,
will generate receive command files (type 2 above).
These command-files will be put on the execution machine and
(This will work only if the local system has permission
to put files in the remote spool directory as controlled
program on the execution machine.
It is made up of several lines,
each of which contains an identification character
and one or more arguments.
The order of the lines in the file is not relevant
and some of the lines may not be present.
Each line is described below.
are the requester's login name and system.
is the generated name of a file for the execute machine
is the last part of the actual file name (contains no
Zero or more of these lines may be present in the
program will check for the existence of all required
files before the command is executed.
The standard input is either specified by a ``<'' in the
command-string or inherited from the standard input of the
command if the ``\-'' option is used.
If a standard input is not specified,
O\ \ file-name\ \ system-name
The standard output is specified by a ``>'' within the
If a standard output is not specified,
(Note \- the use of ``>>'' is not implemented.)
The arguments are those specified in the command-string.
The standard input and standard output will not appear on this
will be moved to the execution directory (a subdirectory
command is executed using the Shell specified in the
In addition, a shell ``PATH'' statement is prepended
to the command line as specified in the
After execution, the standard output is copied or set up to be
sent to the proper place.
Uucico - Copy In, Copy Out
program will perform the following major functions:
Scan the spool directory for work.
Place a call to a remote system.
Negotiate a line protocol to be used.
Execute all requests from both systems.
Log work requests and work completions.
may be started in several ways;
directly by the user (this is usually for testing),
(The uucico program should be specified as the ``shell''
field in the ``/etc/passwd'' file for the ``uucp'' logins.)
When started by method a, b or c, the program is considered to
In this mode, a connection will be made to a remote system.
If started by a remote system (method d),
the program is considered to be in
mode will operate in one of two ways.
If no system name is specified
(\-s option not specified)
the program will scan the spool directory for
If a system name is specified, that system will be called,
and work will only be done for that system.
program is generally started by another program.
There are several options used for execution:
is started by a program or ``cron'' shell.
a call to the specified system
will be made even if there is no work for system
This is useful for polling systems which do not have
the hardware to initiate a connection.
The following options are used primarily for debugging:
is the level of debugging output desired.
The next part of this section will describe the major steps within
The names of the work related files in the spool directory have format
type . system-name grade number
is a four digit, padded sequence number.
for a file transfer between the local
machine and the ``res45'' machine.
The scan for work is done by looking through the
(files with prefix ``C.'').
A list is made of all systems to be called.
will then call each system and process all
The call is made using information from several
files which reside in the uucp program directory.
At the start of the call process, a lock is
set to forbid multiple conversations
between the same two systems.
The system name is found in the
The information contained for each system is;
(days-of-week and times-of-day),
device or device type to be used for call,
phone number if field [3] is
or the device name (same as field [3])
login information (multiple fields),
The time field is checked against the present time to see
if the call should be made.
may contain abbreviations (e.g. mh, py, boston) which get translated into dial
file is scanned using fields [3] and [4] from the
file to find an available device for the call.
The program will try all devices which satisfy
[3] and [4] until the call is made, or no more
If a device is successfully opened, a lock file
is created so that another copy of
If the call is complete, the
The conversation between the two
programs begins with a handshake started by the called,
sends a message to let the
know it is ready to receive the system
identification and conversation sequence number.
and if acceptable, protocol selection begins.
can also reply with a ``call-back required''
message in which case, the current conversation
The remote system sends a message
where proto-list is a string of characters, each
representing a line protocol.
The calling program checks the proto-list
for a letter corresponding to an available line
where code is either a one character
which means there is no common protocol.
) for the work processing are
the mode in which each program starts.
has been specified by the ``\-r1'' uucico option.)
program does a work search similar to the
one used in the ``Scan For Work'' section.
There are five messages used during the
work processing, each specified by the first
character of the message.
messages until all work from the spool directory is
complete, at which point an
\fISY\fR, \fISN\fR, \fIRY\fR, \fIRN\fR, \fIHY\fR, \fIHN\fR,
The send and receive replies are
based on permission to access the
requested file/directory using the
and read/write permissions of the file/directory.
After each file is copied into the spool directory
a copy-complete message is sent by the receiver of the file.
file has successfully been moved from the
temporary spool file to the actual destination.
the transferred file will be in the spool
directory with a name beginning with ``TM'.)
The requests and results are logged on both systems.
The hangup response is determined by the
program by a work scan of the spool directory.
If work for the remote system exists in the
message is sent and the programs switch roles.
message is received by the
and the protocols are turned off.
Each program sends a final ``OO'' message to the
program will clean up and terminate.
will proceed to call other systems
and process work as long as possible
Uuxqt - Uucp Command Execution
program is used to execute
program may be started by either the
The program scans the spool directory for
Each one is checked to see if all the required files are available and
if so, the command line or send line is executed.
is described in the ``Uux''
The execution is accomplished by executing a
of the command line after appropriate
standard input and standard output have been opened.
If a standard output is specified, the program
will create a send command or copy the output
programs create individual
log files for each program invocation.
may be executed to prepend these files to the
This method of logging was chosen to minimize file
locking of the logfile during program execution.
program merges the individual
log files and outputs specified log entries.
The output request is specified by the use of the
is the remote system name;
The intersection of lines satisfying the two options is output.
means all system names or users respectively.
Uuclean - Uucp Spool Directory Cleanup
This program is typically started by the daemon, once a day.
Its function is to remove files from the spool directory which
are more than 3 days old.
These are usually files for work which can not be completed.
The options available are:
The directory to be scanned is
Send mail to the owner of each file being removed.
(Note that most files put into the spool directory
will be owned by the owner of the
uucp programs since the setuid bit will be set on these
The mail will therefore most often go to the owner
Change the aging time from 72 hours to
Examine files with prefix
(Up to 10 file prefixes may be specified.)
This is the level of debugging output desired.
The uucp system, left unrestricted,
will let any outside user execute any commands
and copy in/out any file which is readable/writable
It is up to the individual sites to be aware of this and
apply the protections that they feel are necessary.
There are several security features available aside from the
normal file mode protections.
These must be set up by the installer of the
The login for uucp does not get a standard shell.
Therefore, the only work that can be done is through
A path check is done on file names that are to be sent
supplies the information for these checks.
can also be set up to require call-back
(See the ``Files required for execution'' section
for the file description.)
A conversation sequence count can be set up so
can be more confident that the caller
program comes with a list of commands that it
A ``PATH'' shell statement is prepended to the command
The installer may modify the list or remove the
file should be owned by uucp and have mode 0400
to protect the phone numbers and login information
(Programs uucp, uucico, uux, uuxqt should be also
owned by uucp and have the setuid bit set.)
There are several source modifications that may be required
before the system programs are compiled.
These relate to the directories used during compilation,
the directories used during execution,
The four directories are:
This directory contains the source files for generating the
This is the directory used for the executable system programs and
This is the spool directory used during
(/usr/spool/uucp/.XQTDIR)
This directory is used during execution of
The names given in parentheses above are the default values
will be used in the following text to represent the
appropriate directory names.
There are two files which may require modification,
The following paragraphs describe the modifications.
names from the default values to the directory
names to be used on the local system using
variable definitions which may need modification.
(e.g. INSDIR=/usr/lib/uucp).
This parameter is used if ``make cp'' is
used after the programs are compiled.
This is required to be set if an appropriate
interface subroutine does not exist in the standard
``IOCTL=ioctl.o'' is required in this case.
The statement ``PKON=pkon.o'' is required if the
packet driver is not in the kernel.
will compile the entire system.
will copy the commands to the
to the appropriate directories.
should be put in ``/usr/bin''.
Files required for execution
There are four files which are required for execution,
all of which should reside in the
The field separator for all files is a space unless otherwise
This file contains entries for the call-unit devices and
hardwired connections which are to be used by
The special device files are assumed to be in the
The format for each entry is
line\ \ call-unit\ \ speed
is the device for the line (e.g. cul0),
is the automatic call unit associated with
(Hardwired lines have a number ``0'' in this field.),
would be set up for a system which
had device cul0 wired to a call-unit
cua0 for use at 300 baud.
This file contains entries with location abbreviations used
file (e.g. py, mh, boston).
is the dial sequence to call that location.
would be set up so that entry py7777 would
send 165\-7777 to the dial-unit.
used by a remote computer to call into a local computer
is not the same as the login name of a normal user
However, several remote computers may employ the same
Each computer is given a unique
which is transmitted at the start of each call.
This name identifies the calling machine to the called machine.
This file contains user accessibility information.
It specifies four types of constraint;
which files can be accessed by a normal user of the local machine,
which files can be accessed from a remote computer,
which login name is used by a particular remote computer,
whether a remote computer should be called back in order to confirm
Each line in the file has the following format
is the login name for a user or the remote computer,
is the system name for a remote computer,
is a path-name prefix that is acceptable for
The constraints are implemented as follows.
When the program is obeying a command stored on the local machine,
the path-names allowed are those given for the first line in the
that has a login name that matches the login name of the user
If no such line is found, the first line with a
When the program is responding to a command from a remote machine,
mode, the path-names allowed are those given for the first line
in the file that has the system name that matches the system name
If no such line is found, the first one with a
When a remote computer logs in, the login name that
it uses must appear in the
There may be several lines with the same login name but one of them must
either have the name of the remote system or must contain a
If the line matched in ([3]) contains a ``c'',
the remote machine is called back before any transactions take place.
and request the transfer of files whose names start with
to issue commands for files whose name starts with
allows any remote machine to login with name
but if its system name is not
it can only ask to transfer files whose names start with
allows any user to transfer files beginning with ``/usr''
Each entry in this file represents one system
which can be called by the local uucp programs.
The fields are described below.
The name of the remote system.
This is a string which indicates the days-of-week
and times-of-day when the system should
The day portion may be a list containing
The time should be a range of times (e.g. 0800\-1230).
If no time portion is specified, any time
of day is assumed to be ok for the call.
or the hardwired device to be used for the call.
For the hardwired case, the last part of the
special file name is used (e.g. tty0).
This is the line speed for the call (e.g. 300).
The phone number is made up of an optional
alphabetic abbreviation and a numeric part.
The abbreviation is one which appears in the
file (e.g. mh5900, boston995\-9980).
For the hardwired devices, this field contains
the same string as used for the
The login information is given as a series of
fields and subfields in the format
is the string expected to be read and
is the string to be sent when the
The expect field may be made up of subfields
expect\fB[\fR\-send\-expect\fB]\fR...
is the next expected string.
There are two special names available to be sent
during the login sequence.
will send an EOT character and the string
will try to send a BREAK character.
character is simulated using line speed changes
and null characters and may not work on all
A typical entry in the L.sys file would be
sys Any ACU 300 mh7654 login uucp ssword: word
The expect algorithm looks at the last part of the
string as illustrated in the password field.
This section indicates some events and files which must be
Some administration can be accomplished by
which can be initiated by
Others will require manual intervention.
are given toward the end of this section.
SQFILE \- sequence check file
This file is set up in the
directory and contains an entry for each remote
system with which you agree to perform conversation
The initial entry is just the system name of
The first conversation will add two items to the line,
the conversation count, and the date/time of the most
These items will be updated with each conversation.
If a sequence check fails, the entry will have to
TM \- temporary data files
These files are created in the
directory while files are being copied
Their names have the form
is a sequential three digit number starting at zero
and incremented for each file received.
After the entire remote file is received, the
file is moved/copied to the requested destination.
If processing is abnormally terminated or the
move/copy fails, the file will remain in the
The leftover files should be periodically removed;
program is useful in this regard.
files older than three days.
During execution of programs, individual
directory with information about
queued requests, calls to remote systems,
commands and file copy results.
These files should be combined into the
This program will put the new
files at the beginning of the existing
will accomplish the merge.
Options are available to print some or all the
log entries after the files are merged.
should be removed periodically
since it is copied each time new LOG
entries are put into the file.
files are created initially with mode 0222.
If the program which creates the file terminates normally,
Aborted runs may leave the files with mode
program will not read or remove them.
To remove them, either use
or change the mode to 0666 and let
STST \- system status files
These files are created in the spool directory by the
They contain information of failures such as login, dialup or
sequence check and will contain a
status when to machines are conversing.
The form of the file name is
is the remote system name.
For ordinary failures (dialup, login), the file will prevent
repeated tries for about one hour.
For sequence check failures, the file must be removed before
any future attempts to converse with that remote system.
If the file is left due to an aborted run, it may contain a
In this case, the file must be removed before a conversation
Lock files are created for each device in use (e.g. automatic calling
unit) and each system conversing.
This prevents duplicate conversations and multiple attempts to use the
The form of the lock file name is
is either a device or system name.
The files may be left in the spool directory if runs abort.
They will be ignored (reused) after a time of about 24 hours.
When runs abort and calls are desired before the time limit,
the lock files should be removed.
program will spool work and attempt to start the
program, but the starting of
(No devices available, login failures etc.).
program should be periodically started.
can be put in a ``shell'' file with a command to merge
files and started by a crontab entry on an hourly basis.
The file could contain the commands
Note that the ``\-r1'' option is required to start the
Another shell file may be set up on a daily basis to remove
files for work which can not be accomplished for
reasons like bad phone number, login changes etc.
A shell file containing commands like
Note the ``\-n12'' option causes the
files older than 12 hours to be deleted.
The absence of the ``\-n'' option will use a three day time
A daily or weekly shell should also be created
One or more logins should be set up for
Each of the ``/etc/passwd'' entries should
as the shell to be executed.
The login directory is not used, but if the system
has a special directory for use by the users for
sending or receiving file, it should as the
The various logins are used in conjunction with the
argument limits the login to the use of uucp
It is suggested that the owner and file modes of various
programs and files be set as follows.
login with the ``setuid'' bit set and only execute
permissions (e.g. mode 04111).
This will prevent outsiders from modifying the programs
directory should be owned by
login and set with mode 0400.