All files described in this section are kept in /etc/uucp or a subdirectory thereof. Some Linux distributions contain UUCP binaries that have support for both HDB and Taylor configuration enabled, and use different subdirectories for each configuration file set. There will usually be a README file in /usr/lib/uucp .
For UUCP to work properly, these files must be owned by the uucp user. Some of them contain passwords and telephone numbers, and therefore should have permissions of 600. Note that although most UUCP commands must be setuid to uucp , you must make sure the uuchk program is not . Otherwise, users will be able to display system passwords even though the files have mode 600.
The central UUCP configuration file is /etc/uucp/config , which is used to set general parameters. The most important of them (and for now, the only one) is your host's UUCP name. At the Virtual Brewery, they use vstout as their UUCP gateway:
# /etc/uucp/config - UUCP main configuration file
nodename vstout
The sys file is the next important configuration file. It contains all the system-specific information of sites to which you are linked. This includes the site's name and information on the link itself, such as the telephone number when using a modem link. A typical entry for a modem-connected site called pablo would look like this:
# /usr/lib/uucp/sys - name UUCP neighbors
# system: pablo
system pablo
time Any
phone 555-22112
port serial1
speed 38400
chat ogin: vstout ssword: lorca
time specifies the times at which the remote system may be called. chat describes the login chat scripts - the sequence of strings that must be exchanged to allow uucico to log into pablo . We will get back to chat scripts later. The port keyword simply names an entry in the port file. (Refer to Figure 16.1.) You can assign whatever name you like as long as it refers to a valid entry in port .
The port file holds information specific to the link itself. For modem links, it describes the device special file to be used, the range of speeds supported, and the type of dialing equipment connected to the port. The following entry describes /dev/ttyS1 (a.k.a. COM 2), to which the administrator has connected a NakWell modem capable of running at speeds up to 38,400 bps. The port's name is chosen to match the port name given in the sys file:
# /etc/uucp/port - UUCP ports
# /dev/ttyS1 (COM2)
port serial1
type modem
device /dev/ttyS1
speed 38400
dialer nakwell
The information pertaining to the dialers is kept in yet another file called - you guessed it - dial . For each dialer type, it basically contains the sequence of commands that are issued to dial up a remote site, given the telephone number. Again, this is specified as a chat script. For example, the entry for NakWell might look like this:
# /etc/uucp/dial - per-dialer information
# NakWell modems
dialer nakwell
chat "" AT&F OK ATDT\T CONNECT
The line starting with chat specifies the modem chat, which is the sequence of commands sent to and received from the modem to initialize it and make it dial the desired number. The \T sequence will be replaced with the phone number by uucico.
To give you a rough idea how uucico deals with these configuration files, assume you issue the following command:
$ uucico -s pablo
The first thing uucico does is look up pablo in the sys file. From the sys file entry for pablo , it sees that it should use the serial1 port to establish the connection. The port file tells uucico that this is a modem port, and that it has a NakWell modem attached.
uucico now searches dial for the entry describing the NakWell modem, and having found one, opens the serial port /dev/cua1 and executes the dialer chat. That is, it sends AT&F, waits for the OK response, etc. When encountering the string \T , it substitutes the phone number (555-22112) extracted from the sys file.
After the modem returns CONNECT, the connection has been established, and the modem chat is complete. uucico now returns to the sys file and executes the login chat. In our example, it would wait for the login: prompt, then send its username ( vstout), wait for the password: prompt, and send its password (lorca).
After completing authorization, the remote end is assumed to fire up its own uucico. The two then enter the handshake phase described in the previous section.
Figure 16.1 illustrates the dependencies among configuration files.
Figure 16.1: Interaction of Taylor UUCP configuration files
Before you start writing the UUCP configuration files, you have to gather some information that UUCP requires.
First, you have to figure out what serial device your modem is attached to. Usually, the (DOS) ports COM1: through COM4: map to the device special files /dev/ttyS0 through /dev/ttyS3 . Some distributions, such as Slackware, create a link called /dev/modem to the appropriate ttyS* device file, and configure kermit, seyon, and any other communication programs to use this generic file. In this case, you should use /dev/modem in your UUCP configuration, too.
The reason for using a symbolic link is that all dial-out programs use so-called lock files to signal when a serial port is in use. The names of these lock files are a concatenation of the string LCK… and the device filename, for instance LCK…ttyS1 . If programs use different names for the same device, they will fail to recognize each other's lock files. As a consequence, they will disrupt each other's session when started at the same time. This is quite possible when you schedule your UUCP calls using a crontab entry. For details on serial port setup, please refer to Chapter 4, Configuring the Serial Hardware.
Next, you must find out at what speed your modem and Linux will communicate. You have to set this speed to the maximum effective transfer rate you expect to get. The effective transfer rate may be much higher than the raw physical transfer rate your modem is capable of. For instance, many modems send and receive data at 56 kbps. Using compression protocols such as V.42bis, the actual transfer rate may climb over 100 kbps.
Of course, if UUCP is to do anything at all, you need the phone number of a system to call. Also, you need a valid login ID and possibly a password for the remote machine. [91] If you're just going to try out UUCP, get the number of an archive site near you. Write down the login and password - they're public to make anonymous downloads possible. In most cases, they're something like uucp/uucp or nuucp/uucp.
You also have to know exactly how to log into the system. Do you have to press the Enter key before the login prompt appears? Does it display login: or user:? This is necessary for composing the chat script . If you don't know, or if the usual chat script fails, try to call the system with a terminal program like kermit or minicom and record exactly what you have to do.
Читать дальше