UNIX: TCR Companion Web Site10/27/18

UNIX: TCR Companion Web Site10/27/18

UNIX: TCR companion Web site10/27/18

(ct)The UUCP System

Editor's Note: Cross references in the text refer to chapters in the companion book, UNIX: The Complete Reference by Rosen, Host, Farber, and Rosinski.

The UNIX System was designed to allow different computers to communicate easily. It is noted for its wide range of communications and networking capabilities, which include facilities for electronic mail, file transfer, logging into remote machines, remote execution of commands, and file sharing. The original utilities designed for these tasks are included in a part of the UNIX System called the UUCP System. Although the UUCP System has been supplanted for many uses by TCP/IP utilities (described in Chapter 12), it is still used extensively and you may still find its capabilities useful.

This chapter will describe the Basic Networking Utilities (BNU), included with versions of UNIX based on UNIX System V Release 4, which include commands you can use to call another system, and the UUCP System. (Most other versions of UNIX should have these commands as well.) You can use the UUCP System to transfer files between computers or to execute a command on a remote machine. In this chapter, you will learn how to use the Basic Networking Utilities to call up and log into remote systems. You will learn how to transfer files between computers using several different UUCP System utilities and how to handle files sent to you via the UUCP System. Also, you will learn how to execute commands on remote systems using the uux command. Moreover, in this chapter you will learn how to administer the UUCP System.

(1)The Basic Networking Utilities

The Basic Networking Utilities include the UUCP System and the cu and ct commands used to call other machines known to your system. The UUCP System is named after the uucp command (UNIX-to-UNIX System copy), used to transfer files. Besides the uucp command, the UUCP System includes a wide range of other commands. The most important user commands in the Basic Network Utilities are displayed in Table 1.

Command / Action
cu / Call another system and manage a dialog, including ASCII file transfer.
ct / Dial a remote terminal and generate a login process.
uucp / Copy files from your system to another, allowing the remote system to control file access (by default, files are copied into a public directory, /var/spool/uucppublic).
uupick / Search /var/spool/uucppublic for files sent to you, and prompt for their disposition.
uux / Execute a command on a remote system.
uuname / Print the names of all systems known to uucp.
uustat / Display the status of current uucp jobs; cancel previous jobs; provide system performance information.

Table 1: Important BNU Commands for Users

(2)The Development of the UUCP System

The UUCP System dates back to 1976, when it was first conceived and developed by Mike Lesk at Bell Laboratories. A rewritten, enhanced, and improved version of the UUCP System, known as Version 2 UUCP, was included in early releases of the UNIX System and was the standard version until 1983. However, the extensive use of the UUCP System across a wide range of communications facilities made it necessary to enhance its capabilities and performance. A new version of the UUCP System was developed by Peter Honeyman, David Nowitz, and Brian Redman at Bell Laboratories in 1983, supporting a wider range of networking, providing administrative facilities, and correcting deficiencies in Version 2 UUCP. This version, known as HoneyDanBer (from the logins of its developers, honey, dan, and ber), was incorporated in UNIX System V Release 2 and is the basis of the Basic Networking Utilities in Release 4. The Basic Networking Utilities are (almost completely) compatible with Version 2 UUCP Systems, so that computers running older versions of the UUCP System can communicate with machines running newer versions of UUCP.

Other versions of the UUCP System, including Taylor UUCP, have been developed as part of the GNU Distribution. The Taylor UUCP System is included with Linux. How commands work in Taylor UUCP is similar to how they work in Version 2 UUCP.

(2)The UUCP Network

Traditionally, one of the networks used to transfer electronic mail between UNIX computers was the UUCP Network, a collection of machines known to one another. Machines on the UUCP networks are connected in a variety of ways: They are linked via dedicated private line communications; they are connected on a local area network; or they are connected via modems through the telephone network. (Today, instead of the UUCP Network, electronic mail is generally transferred over the Internet, using TCP/IP.)

If your system is part of the UUCP Network, it may be connected to only a few other systems, or it may be connected to hundreds in a network of interconnected systems. Let’s consider a small hypothetical network. In this example, there are seven machines. They can be diverse machines, made by different manufacturers, with different hardware, and even running different releases or versions of the UNIX System. They can even be running other operating systems for which the UUCP System has been developed.

In this network, the machine jersey knows about alpha, bravo, chucky, hotdog, and zephyr. Meanwhile, hotdog and zephyr also know about each other, but ferdie is known only to zephyr. When we say that jersey knows about alpha, it means that jersey can connect (via dial-up telephone line, LAN, or dedicated private line) to alpha, and that jersey is allowed to log into alpha to exchange information.

Normal network connections are bidirectional. If jersey can connect, log in, and send information to alpha, then alpha can connect, log in, and send information to jersey. This is not always necessary, however, and the UNIX System provides the flexibility to have a system call out but not receive calls, or vice versa. For example, often a large computer will poll many smaller computers in a network; in this case, the smaller computers receive calls but do not call out.

A user on jersey can exchange information with any user on alpha, bravo, chucky, hotdog, and zephyr: Communication is particularly flexible, since any user on any of these systems can communicate with any other user on these systems. A user on alpha can go through jersey to get to a user on bravo, or through jersey and zephyr to get to a user on ferdie.

This network of computers is easily expanded. As soon as the system administrators agreed to connect zephyr and ferdie (by exchanging and installing one line of system administration information), all users on ferdie had access to the entire network of machines. If, in the future, ten other machines connect with ferdie, then all of the users on those machines can also be connected to jersey, alpha, bravo, chucky, hotdog, and zephyr.

Regardless of the nature of the connection, the systems and the details of how to connect with them are specified in uucp configuration files. The UUCP System uses the information contained in these configuration files, maintained by your system administrator, to determine how to connect with a remote system. Configuration files, and the way that uucp uses them, will be discussed later in this chapter. As a user, you need only know a path to your destination machine. You do not need to know the nature of connections between the computers in this path.

(3)The Structure of the UUCP Network

The UUCP Network is a network of machines that has no central administration. This means that no computer manages the entire network. You join the network by finding another machine already on the UUCP Network that agrees to be your neighbor, in the sense that this computer agrees to add configuration information for setting up a connection with your machine. Once you have found a neighbor, you can then connect through this machine to all other machines that can connect to it. To communicate with a remote computer not known to your computer, you need a path to this computer. The problem of finding such a path is partly mitigated by the existence of the UUCP Map, which specifies connections between various computers. The UUCP Map is kept by the UUCP Network Project, which posts this map each month in the comp.mail.maps newsgroup. Each host on the UUCP Network pays the costs of the links connecting to other machines.

(3)Using uuname

The ease of connecting to and extending the UUCP Network is one reason why it has grown to include thousands of machines. When your machine is part of the UUCP Network, it will know about and be known by one or more other machines. To find out which systems your system knows about, use the uuname command, as in the following example:

$ uuname
alpha
bravo
chucky
hotdog
zephyr

The uuname command prints the list of all systems that your system can directly connect with using uucp. On some systems, the number of machines that can be contacted using uucp may run into the hundreds. Each system is listed separately on a line, so you can determine the number of computers that your system can connect to directly by counting the lines returned by uuname. For instance,

$ uuname | wc -l
2840

shows that the system on which this command line has been run (a computer at AT&T Laboratories) is directly connected to 2,840 other systems. Smaller computers are usually connected to fewer machines or sometimes only one.

To see if a specific system is known to yours, pipe the output of uuname to grep to search for that system name. This will print out the name of the system if it is in the uuname list, but will return nothing if it is not. For example,

$ uuname | grep chicago
$ uuname | grep chucky
chucky

shows that the current system knows about the system chucky but not the system chicago. Using uuname with the –l (local) option prints out the name of your local system. For example,

$ uuname -l
jersey

means that the name of the system you are on is jersey, and more important, that it is known to other systems on the UUCP Network by that name.

(2)Using the cu Command to Call a Remote System

The cu (Call UNIX) command allows you to log in and use a remote system from your home system. When you use cu, your system accesses the remote system using a dedicated communications line, a local area network, or a modem, depending on the configuration of certain files (described later in this chapter).

(3)Making the Connection

When you use cu, you first call the remote system and make a connection with it. Remote systems known to your system can be called by name. You can also connect to a remote system by instructing your system how to make the connection.

You can call a system known to yours by name (listed in the uuname command output) using the cu command with the name of the system as an argument. You do not know how the systems are connected, since the file, /etc/uucp/Systems, maintains this information. (Details on this file and how it is used are provided later in this chapter.) If there are many connections between systems, cu has the ability to choose among several media to establish the connection. For example, you can use cu to connect to the system alpha, known to your computer, using the following command:

$ cu alpha
Connected
login:

Using cu to contact the system alpha results in the Systems file being checked and a connection being set up according to the Systems file configuration. Once your system has successfully connected with alpha, you see the “Connected” message, followed by the normal “login:” prompt and login procedure on alpha. If you try to contact a system that is not included in the Systems file, you will get a message like this (depending on the particular version of UNIX you run):

$ cu beta
Connection failed: SYSTEM NOT IN Systems FILE.

In new versions of UNIX (including those based on Release 4), the cu command has been enhanced to recognize eight-bit and multibyte characters, such as kanji characters.

(3)Using cu with Telephone Numbers

If you specify a telephone number as an argument to cu, an automatic calling unit (ACU) listed in the file /etc/uucp/Devices will be selected, and the system will dial the telephone number to be called.

A valid telephone number for cu is a string consisting of digits 0 through 9, the symbols * and # (from the telephone keypad), and the symbols = and –. The = symbol instructs cu to wait for a secondary dial tone before dialing the rest of the string; the – symbol introduces a pause (four seconds long) before dialing further.

Suppose you have to dial 9, wait for a dial tone for an outside line, and then dial the number 1 (201) 555-1234 to reach alpha. You would call alpha using the command:

$ cu 9=12015551234

If you need to dial a *9 before reaching an outside line, use the following command:

$ cu "*9=12015551234"

The quotation marks are required so that the * is not interpreted by the shell.

If you dial a system but no connection can be made, you will get an error message. For instance:

$ cu 9=12015551234
Connect failed: CALLER SCRIPT FAILED

If there is a problem with the ACU, the cu command may appear to hang.

(4)COMMONLY USED cu OPTIONS FOR CONNECTIONS

The cu command supports several options for calling out to another system. Among these are the following:

–sspeed / Specify the transmission speed in bits per second to be used for the connection. The default is “Any,” in which the value will depend on the speed in the /etc/uucp/Devices file (described later).
–ctype / Specify the local area network to be used. The value of type is taken from the first field of the /etc/uucp/Devices file. (In versions of UNIX based on Release 4, the –c option can also be used to specify a class of lines.)
–lline / Specify the device to be used as a communications line. The option overrides selection of devices from the Devices file.
–e / Set even parity.
–o / Set odd parity.
–h / Set half-duplex.
–b n / Set n (7- or 8-bit) characters.
–n / Prompt for a telephone number. This provides additional user security, since the telephone number is not part of the command line and therefore is not displayed in response to a ps –f command.
–t / Call out to a terminal with an auto-answer modem (see also the ct command).

To call alpha using 28800 baud, dial 9 to get an outside line, and then 1 (201) 555-1234, using the following command:

$ cu -s28800 9=12015551234

To call out over a modem attached to /dev/term/04, use the following command line:

$ cu -lterm/04 9=12015551234

(3)Using Your cu Connection

After making a connection with the remote system, cu runs as two separate processes, a transmit process and a receive process.

The transmit process reads from your standard input (normally your keyboard) and passes this input to the remote system, except for lines that start with a tilde (~). The receive process accepts input from the remote system and, except for lines that start with a tilde, passes this input to your standard output. The special meaning of lines beginning with ~ will be described later.

(3)Running Commands During a cu Session

Once you are logged into the remote system, you can do anything normally possible on that system. For instance, suppose you log in from jersey to nevada by typing the following command on jersey:

$ cu nevada
Connected
login:

After successfully logging in by supplying your username and password, you can run commands on nevada, such as:

$ who
npm term/17 Feb 2 14:45
ddr term/04 Feb 2 09:06
khr term/01 Feb 2 12:07
greg term/12 Feb 2 12:53

(3)Commands Used with cu

One reason for using cu is that it supports simple ASCII file transfer, even with computers not running the UNIX System. (The parity and half-duplex options may be required for other systems; computers running the UNIX System normally do not require these.) As long as the remote system provides the stty, echo, and cat commands, cu can exchange files.

You use the cu command ~%take to copy files from the remote system to your local computer. The general form of this command is

~%takethere [here]

The preceding command “takes” (copies from the remote system) the file there and copies it to the file here on the local system. You use the cu command ~%put to copy files from the local computer to the remote computer. The general form of this command is

~%puthere [there]

This command “puts” (copies to the remote system) the file here from the local system with the name there. Note that after you type ~%, cu will put the name of your local system between the ~ and the %.

For example, suppose you have logged into nevada by running a cu session from jersey. You can take the file memo on nevada and copy it into the file named newmemo on jersey using the following command: