📄 unx43.htm
字号:
<HTML>
<HEAD>
<TITLE>UNIX Unleashed unx43.htm</TITLE>
<LINK REL="ToC" HREF="index.htm">
<LINK REL="Next" HREF="unx44.htm">
<LINK REL="Previous" HREF="unx42.htm"></HEAD>
<BODY TEXT="#000000" LINK="#0000FF" VLINK="#800080" bgcolor=white>
<P><A HREF="unx42.htm"><IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
<A HREF="index.htm"><IMG SRC="blutoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
<A HREF="unx44.htm"><IMG SRC="blunext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>
<A HREF="index.htm"><IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Home"></A>
</P><UL>
<UL>
<LI>
<A HREF="#I1">43 — UUCP Administration</A></LI>
<UL>
<UL>
<UL>
<LI>
<A HREF="#I3">By James C. Armstrong, Jr.</A></LI></UL></UL>
<LI>
<A HREF="#I4">What Is UUCP?</A></LI>
<UL>
<LI>
<A HREF="#I5">Transferring Files</A></LI>
<LI>
<A HREF="#I6">Running Remote Commands</A></LI>
<LI>
<A HREF="#I7">Under It All</A></LI>
<UL>
<LI>
<A HREF="#I8">Chat Scripts</A></LI>
<LI>
<A HREF="#I9">Connection Files</A></LI></UL></UL>
<LI>
<A HREF="#I10">Setting Up UUCP</A></LI>
<UL>
<LI>
<A HREF="#I11">Receiving UUCP Calls</A></LI>
<LI>
<A HREF="#I12">Initiating UUCP Calls</A></LI>
<UL>
<LI>
<A HREF="#I13">Testing the Connection</A></LI></UL>
<LI>
<A HREF="#I14">More on Chat Scripts</A></LI>
<LI>
<A HREF="#I15">Administering the Files</A></LI>
<UL>
<LI>
<A HREF="#I16">Devices</A></LI>
<LI>
<A HREF="#I17">Dialers</A></LI>
<LI>
<A HREF="#I18">Dialcodes</A></LI>
<LI>
<A HREF="#I19">Permissions</A></LI>
<LI>
<A HREF="#I20">Sysfiles</A></LI>
<LI>
<A HREF="#I21">Poll</A></LI></UL>
<LI>
<A HREF="#I22">Supporting Files</A></LI>
<LI>
<A HREF="#I23">UUCP Daemons</A></LI>
<UL>
<LI>
<A HREF="#I24">The admin Daemon</A></LI>
<LI>
<A HREF="#I25">The cleanup Daemon</A></LI>
<LI>
<A HREF="#I26">The polling Daemon</A></LI>
<LI>
<A HREF="#I27">The hourly Daemon</A></LI></UL></UL>
<LI>
<A HREF="#I28">Using UUCP</A></LI>
<UL>
<LI>
<A HREF="#I29">uuto and uupick</A></LI></UL>
<LI>
<A HREF="#I30">UUCP Utilities</A></LI>
<LI>
<A HREF="#I31">Summary</A></LI></UL></UL></UL>
<H2 ALIGN="CENTER">
<CENTER><A ID="I1" NAME="I1">
<FONT SIZE=5><A ID="I2" NAME="I2"></A><B>43 — UUCP Administration</B>
<BR></FONT></A></CENTER></H2>
<H5 ALIGN="CENTER">
<CENTER><A ID="I3" NAME="I3">
<FONT SIZE=3><B>By James C. Armstrong, Jr.</B>
<BR></FONT></A></CENTER></H5>
<P>Long before the days of Networking, TCP/IP, NFS, and the like, there was still the need for UNIX machines to communicate with each other, to pass data, and to transfer files. Modern networks make this task easy, but if your machine is not attached to
one of these networks, or if there is no direct network connection between your machine's network and the target machine's network, then there must be a technique for this communication. The package that handles these transfers is UUCP.
<BR></P>
<P>UUCP was originally written by Mike Lesk at Bell Labs in the mid-1970s, to facilitate communication between the growing network of UNIX machines. It has been modified several times since then, with the most fundamental changes occurring in 1983, when
UUCP was rewritten by Peter Honeyman, David A. Nowitz, and Brian E. Redman. This is the standard UUCP distributed with System V Release 4, and sometimes goes by the moniker HoneyDanBer. It is this version of UUCP that this chapter covers.
<BR></P>
<H3 ALIGN="CENTER">
<CENTER><A ID="I4" NAME="I4">
<FONT SIZE=4><B>What Is UUCP?</B>
<BR></FONT></A></CENTER></H3>
<P>UUCP is the package of commands that allows a user to transfer data from one machine to another across a serial port, usually via a modem. Probably the most common uses of UUCP are the transfer of network e-mail and netnews, as described in Chapter 41,
"Mail Administration", and Chapter 42 "News Administration". In both cases, the underlying UUCP commands are hidden from the regular user.
<BR></P>
<H4 ALIGN="CENTER">
<CENTER><A ID="I5" NAME="I5">
<FONT SIZE=3><B>Transferring Files</B>
<BR></FONT></A></CENTER></H4>
<P>The most likely contact a regular UNIX user has with UUCP is the command uucp. This is just an expansion of the cp command, with a special format to indicate the transfer to a new machine. The target machine and path are illustrated with an exclamation
point. Assume that I have a file named data on a local machine named duke. I want to transfer that file to my home directory, /usr/james, on a machine named unc. This is the command I'd use:
<BR></P>
<PRE>uucp data unc!/usr/james/data</PRE>
<P>I do not need to specify the machine I am on, so I indicate just the current file. I then indicate that I want to send the file to the machine unc, with the file name there as /usr/james/data. This is an example of pushing a file to a new machine via
uucp.
<BR></P>
<HR ALIGN=CENTER>
<NOTE>
<IMG SRC="caution.gif" WIDTH = 37 HEIGHT = 35><B>CAUTION: </B>Most systems set up permissions on data transfers that make the uucp command invalid, unless copied to one specific directory on the remote machine. Furthermore, setting permissions to allow
transfers to and from any directory is very risky and is not secure. Permissions are discussed later in the chapter.
<BR></NOTE>
<HR ALIGN=CENTER>
<P>Files may also be pulled from machines. Suppose I have successfully copied data to unc, and now I need a copy back. I can do this with this command:
<BR></P>
<PRE>uucp unc!/usr/james/data .</PRE>
<P>In this case, the source file is on the unc machine, and I pull over a copy. If unc has the correct permissions, I can pull the needed file over to my machine and place it in my current directory.
<BR></P>
<P>Files can be transferred from one remote machine to another. In the first example, if I were on machine ncsu when I wanted to transfer a file from duke to unc, I could do it with this command:
<BR></P>
<PRE>uucp duke!/usr/james/data unc!/usr/james/data 2</PRE>
<P>The syntax of the command says "Go to machine duke and find the file /usr/james/data, then send it to machine unc to the destination /usr/james/data 2." Finally, if I want to send the file from duke to wake, but wake only has a link with unc,
I can specify a path like this:
<BR></P>
<PRE>uucp duke!/usr/james/data unc!wake!/usr/james/data</PRE>
<P>If the permissions at unc allow the transfer, the file is first sent to unc, then sent from unc to wake.
<BR></P>
<HR ALIGN=CENTER>
<NOTE>
<IMG SRC="note.gif" WIDTH = 35 HEIGHT = 35><B>NOTE:</B> You may have attempted these commands and received an error message such as /usr/james/data: Event not found. This is because the ! is significant to the C shell—it implies history substitution.
To avoid this problem, you should escape the ! with a backslash (\), making the command uucp duke\!/usr/james/data unc\!/usr/james/data. This will also work with the Bourne and Korn shells and is a practice I find useful.
<BR></NOTE>
<HR ALIGN=CENTER>
<HR ALIGN=CENTER>
<NOTE>
<IMG SRC="imp.gif" WIDTH = 68 HEIGHT = 35><B>TIP: </B>A much easier technique for transferring files from the local machine to a remote machine is using uuto and uupick. These commands are simply shell scripts that change their arguments into a
well-constructed uucp command for you. Their usage is described in more detail in the section "UUCP Utilities."
<BR></NOTE>
<HR ALIGN=CENTER>
<H4 ALIGN="CENTER">
<CENTER><A ID="I6" NAME="I6">
<FONT SIZE=3><B>Running Remote Commands</B>
<BR></FONT></A></CENTER></H4>
<P>UUCP also provides a command that allows the user to run commands remotely. The uux command enables a user to request that a remote machine run a command. It will accept redirection of standard input and output, and options can be used to indicate that
the redirection should apply to the remote command's execution. For example, this command will return the output of the date command as run on unc:
<BR></P>
<PRE>uux unc!date</PRE>
<P>uux is normally hidden from the user, but it is the backbone for mail and news transfer. On my machine, I transfer news to a remote machine by piping the article into the command uux - -r -gd netcomsv!rnews. While this may look complicated, all it
really says is that the standard input of this command will be fed to the remote machine netcomsv, and there the command rnews will be run. The -r option says to queue the request, and -gd sets a system priority on the request. Both options could easily be
omitted.
<BR></P>
<P>The command for transferring mail is even simpler. When my mailer gets the request to send mail to a remote system, it executes uux - -r netcomsv!rmail. This is simplicity itself—it just pipes the mail message to rmail on netcomsv.
<BR></P>
<HR ALIGN=CENTER>
<NOTE>
<IMG SRC="note.gif" WIDTH = 35 HEIGHT = 35><B>NOTE:</B> For security reasons, most sites have cut off remote execution of commands other than rmail and rnews. If you plan on needing to execute commands other than rnews and rmail, you should consult with
the administrator of the remote machine.
<BR></NOTE>
<HR ALIGN=CENTER>
<H4 ALIGN="CENTER">
<CENTER><A ID="I7" NAME="I7">
<FONT SIZE=3><B>Under It All</B>
<BR></FONT></A></CENTER></H4>
<P>Beneath all the UUCP commands is the uucico command. This is the process that implements the actual communication between UNIX machines. Most users will never need to use this command, and its use by administrators is also rare.
<BR></P>
<P>uucico examines a series of data files to make its connection. These files include information such as which tty is used as a port, what modem commands are needed to use the attached modem, what is the phone number of the remote system, and what is the
login protocol. Attached to both the modem commands and the login commands are what is called a "chat script." These chat scripts are the essence of UUCP communications.
<BR></P>
<H5 ALIGN="CENTER">
<CENTER><A ID="I8" NAME="I8">
<FONT SIZE=3><B>Chat Scripts</B>
<BR></FONT></A></CENTER></H5>
<P>Chat scripts are simply pairs of expect/send sequences. When all the criteria are met for communications, the uucico process waits on the port until it sees the next expect sequence. After that sequence is seen, the next send sequence is sent down the
line. If the expect sequence is not seen in a certain period of time, a time-out occurs, and a different send sequence can be sent. If all expect/send sequences are completed, the connection starts to transfer data. If the send sequences are exhausted and
no connection is made, the command fails.
<BR></P>
<P>The following is an example of a chat script for logging in to a machine:
<BR></P>
<PRE>"" \n in:—in: mylogin word: mypassword</PRE>
<P>Interpreted, this means that I first expect nothing and send a carriage return. When I see the sequence in: I send the sequence mylogin. If I don't see in:, then I wait for a time-out and send a new carriage return and continue to look for in:. Once I
send mylogin, I wait for word:. Once I see that, I send mypassword and expect to start the data transfer.
<BR></P>
<P>The — in the expect sequence indicates that I might get a time-out and I might need to send more data. Any character sequence can be between the two dashes, and these are sent, along with a carriage return, and then a time-out occurs. Any number of
these time-out sequences can occur in an expect pattern. If a line is known to be slow to acknowledge the connection, one may see the sequence in:—in:—in:—in:, which means to try four times to get the login: prompt before timing out. Some
experimentation may be necessary to determine the exact chat script to connect to a machine. This is described in the section "Setting Up UUCP."
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -