⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch44.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 4 页
字号:
to a physical device. This file is <TT>/usr/lib/uucp/port</TT>, and it requires an



entry similar to this for a 9600 baud modem:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF"># com1 device port



port     com1



type      modem



device     /dev/cua0



speed     9600



dialer     Hayes



</FONT></PRE>



<P>In the <TT>/usr/lib/uucp/port file</TT>, the name of the port used in the <TT>/usr/lib/uucp/sys</TT>



file is identified on the first line. The type of connection to be used (usually



modem) is on the next. The actual Linux device that corresponds to the port name



is specified as a device driver (for many Linux systems this can be <TT>/dev/modem</TT>,



which is linked to the serial port device driver).</P>



<P>The modem connection speed comes next, and shows the maximum speed the modem can



be used at. Finally, the name of a dialer is entered. This is a throwback to the



days when modems couldn't dial themselves, but used another device (called a dialer)



to make the connection.</P>



<P>The dialer entry in the <TT>/usr/lib/uucp/port</TT> file is then matched to an



entry in the file <TT>/usr/lib/uucp/dial</TT>, which tells the modem how to dial



the phone. Here's a simple entry:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF"># Hayes modem 



dialer     Hayes



chat     &quot;&quot; ATZ OK ATDT\T CONNECT



</FONT></PRE>



<P>This shows the script that the system uses to communicate to the Hayes modem.



In this case, the <TT>\T</TT> in the command line is replaced with the telephone



number to be called. Some Linux systems simplify the use of the <TT>/usr/lib/uucp/port</TT>



and <TT>/usr/lib/uucp/dial</TT> files into one single entry in the <TT>/usr/lib/uucp/sys</TT>



file, which names the modem file directly.</P>



<P>The remote end of the connection (in this case, the system <TT>arthur</TT>) must



have corresponding entries for <TT>merlin</TT>. The files will be similar with only



name, telephone number, and (possibly) device name and <TT>chat</TT> script changes.



Until both ends are configured properly, you can't get a connection between the two



machines.</P>



<P>Some Linux systems with Taylor UUCP have a utility called <TT>uuchck</TT> that



verifies the syntax in the UUCP configuration files and prints out summary information.



If you don't have the <TT>uuchck</TT> utility, it can be downloaded from many FTP



and BBS sites. Check Appendix A, &quot;FTP Sites and Newsgroups,&quot; for some of



the possible sites.</P>



<P>By default, Taylor UUCP allows a remote system to execute only a limited number



of commands when they log into your system. Typically, the remote is only allowed



to execute <TT>rmail</TT> and <TT>rnews</TT>, to transfer mail and news, respectively.



If you want to allow extra programs to be executed, add a line to the <TT>/usr/lib/uucp/sys</TT>



file that includes all the commands the remote system can execute. For example, the



entry<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">system     chatton



....



commands     rmail rnews rsmtp rdataupdate 



</FONT></PRE>



<P>specifies that the system <TT>chatton</TT> can execute any of the four commands



given after the <TT>commands</TT> keyword. Note that all four commands must be in



the usual search path used by the UUCP utilities (actually by <TT>uuxqt</TT>).</P>



<P>If you intend to transfer files between two machines, you must also modify the



configuration files. When a remote system sends a file to your machine, the files



usually should be stored in the directory <TT>/usr/spool/uucppublic</TT> (some systems



use <TT>/var/spool/uucppublic</TT>) as a safety precaution. You don't want to allow



a remote system to write files anywhere on your file system, or they could overwrite



critical system files. The convention for most UUCP systems is to use either <TT>/usr/spool/uucppublic</TT>



or <TT>/usr/spool/uucp/</TT>system (where system is the remote system's name) as



the transfer directories.</P>



<P>You can specify transfer and receive directories in the <TT>/usr/lib/uucp/sys</TT>



file. For example, the following entry for the remote system <TT>chatton</TT> has



been modified to include specific directories for file transfers:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">system     chatton



...



local-send     ~/send



local-receive     ~/receive



</FONT></PRE>



<P>In this configuration, the users on your local machine can send any file that



is in the <TT>send</TT> directory under the <TT>uucp</TT> directory (<TT>~/send</TT>,



which means that any file to be sent to a remote system must be transferred there



first), and any file incoming from a remote system is stored in the <TT>receive</TT>



directory under the <TT>uucp</TT> directory. If you want to allow transfers from



a user's home directory, you can specify the <TT>/usr</TT> directory as a starting



point. Multiple entries are separated by spaces, so the entry<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">local-send    ~/send /usr



</FONT></PRE>



<P>allows transfers from the <TT>send</TT> directory under the <TT>uucp</TT> directory,



or from any directory under<TT> /usr</TT>.</P>



<P>The preceding two lines deal only with file transfers requested or sent from your



machine. If you want to enable requests for transfers from the remote machine, you



need to add two more lines:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">remote-send     /usr/lib/uucppublic



remote-request     /usr/lib/uucppublic



</FONT></PRE>



<P>This forces the remote machine to request files and send them only to the <TT>/usr/lib/uucppublic</TT>



directory. Again, you can offer several choices if you want, as long as they are



separated by spaces.</P>



<P>Finally, UUCP allows machines to forward data through other machines, a process



called hopping. In other words, if you want to send mail to the system <TT>warlock</TT>



but can only get there through the system <TT>wizard</TT>, you have to instruct UUCP



that your local system can get to <TT>warlock</TT> through <TT>wizard</TT>. You add



a forward command to the <TT>/usr/lib/uucp/sys</TT> file:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">system     wizard



...



forward     warlock



</FONT></PRE>



<P>You should then add an entry for the <TT>warlock</TT> system that tells UUCP that



any mail for you will be coming back through <TT>wizard</TT>. The matching entry



would be this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">system     warlock



...



forward-to     merlin



</FONT></PRE>



<P>The <TT>forward-to</TT> entry is necessary so that any files returned by <TT>warlock</TT>



are passed to <TT>merlin</TT>, the local host machine. Otherwise, they would be discarded



by UUCP as not being routable.</P>



<P>By default, Taylor UUCP does not allow forwarding, and most system administrators



should think carefully about allowing it because the potential for abuse is high.



<H4 ALIGN="CENTER"><A NAME="Heading7<FONT COLOR="#000077">HDB UUCP Configuration</FONT></H4>



<P>HDB UUCP is a more recent version of UUCP and its configuration files are different.



In many ways, the HDB configuration is easier than Taylor UUCP's, although neither



is difficult once you know the basic process.</P>



<P>The name of the local system is not set in the UUCP configuration files but by



the Linux hostname itself. To set the system name use the <TT>hostname</TT> command.</P>



<P>The names of the remote systems are stored in the file <TT>/usr/lib/uucp/Systems</TT>



(some older versions used the name <TT>/usr/lib/uucp/L.sys</TT>). There is a single



line for each remote system that you will be connected to. The format of each line



is<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">sitename  schedule  device_type  speed  phone  login_script



</FONT></PRE>



<P>where sitename is the name of the remote machine, schedule is when it can be connected



to, device_type is the type of device to use to call the remote system, speed is



the speed (or range of speeds) that can be used to connect, phone is the telephone



number, and login_script is the script used when a connection is made (such as the



<TT>chat</TT> script in Taylor UUCP). For example, to call the remote system <TT>arthur</TT>,



the <TT>/usr/lib/uucp/Systems</TT> file would have a line like this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">arthur Any ACU 9600 555-1212 login: uucp password: secret1



</FONT></PRE>



<P>The <TT>Any</TT> entry in the schedule field tells UUCP that it can call at any



time. The <TT>ACU</TT> entry in the device field tells UUCP to use the ACU (automatic



calling unit) defined in the <TT>/usr/lib/uucp/Devices</TT> file.</P>



<P>The <TT>/usr/lib/uucp/Devices</TT> file (or <TT>/usr/lib/uucp/L-devices</TT> file



in some older versions) contains information about the devices that can be used to



call the remote systems. The <TT>Devices</TT> file follows the syntax<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">devicetype  ttyline  dialerline  speed  dialer  [token  Dialer  ...]



</FONT></PRE>



<P>where devicetype is the name of the device (which should match the device name



in the <TT>/usr/lib/uucp/Systems</TT> file), ttyline is the device driver to be used



for the connecting port (usually a serial line, such as <TT>/dev/tty2a</TT> or <TT>/dev/modem</TT>),



dialerline is an obsolete field left as a hyphen, speed is the speed range of the



device, and dialer is the name of the file that tells UUCP how to use the device.



A sample line for a Hayes 9600 baud modem used to connect on the second serial port



of the system might have an entry in the <TT>/usr/lib/uucp/Devices</TT> file like



this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">ACU tty2A - 9600 dialHA96



</FONT></PRE>



<P>This identifies the <TT>ACU</TT> entry as a 9600 baud connection through <TT>/dev/tty2A</TT>



(the <TT>/dev</TT> portion of the name is not needed with HDB UUCP), and it uses



a program called <TT>dialHA96</TT> to handle the setup and dialing of the modem.



There are usually programs available for most popular modems that set the modem configuration



parameters automatically, leaving Linux out of that process.</P>



<P>If a modem program is not available to handle the modem, an entry in the file



<TT>/usr/lib/uucp/Dialers</TT> can be used. The format of the Dialers entry is<FONT



COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">dialer translation  expect  send  ...



</FONT></PRE>



<P>where dialer is the name of the dialer (matching the Devices file), translation



is the translation table to use for the phone number (converting characters where



needed to pauses, beeps, and so on), and the expect/send entries are the <TT>chat</TT>



script to set up the modem. A sample line in the Dialers file looks like this:<FONT



COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">hayes1200 =,-,    &quot;&quot; AT\r\c OK\r \EATDT\T\r\c CONNECT



</FONT></PRE>



<P>This is the entry for a Hayes 1200 Smartmodem, identified by the name hayes1200,



with translations for the <TT>=</TT> and <TT>-</TT> characters, followed by the <TT>AT</TT>



commands used to set up the modem. Since these entries are usually supplied in the



Dialers file for most popular modems, we won't bother going into detail about them.</P>



<P>Permissions for file transfers are a little more convoluted with HDB UUCP than



Taylor UUCP, because HDB UUCP adds many features for special handling. Instead of



looking at all the file transfer permissions, you are better advised to consult a



specialty book on UUCP, because the subject can easily consume 100 pages by itself!



For this reason, we'll look at the fundamentals--just enough to get you set up properly.</P>



<P>Permissions for remote system access and file transfers are handled by the file



<TT>/usr/lib/uucp/Permissions</TT>. The general format of the entries in this file



is<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">MACHINE=remotename LOGNAME=uucp \



     COMMANDS=rmail:rnews:uucp \



     READ=/usr/spool/uucppublic:/usr/tmp \



     WRITE=/usr/spool/uucppublic:/usr/tmp \



     SENDFILES=yes REQUEST=no 



</FONT></PRE>



<P>where <TT>MACHINE</TT> identifies the remote machine's name, <TT>LOGNAME</TT>



is the name they use to log in (or you use to log in to their system), <TT>COMMANDS</TT>



are the commands they can execute on your local system, <TT>READ</TT> is the list



of directories they can read files from, <TT>WRITE</TT> is the list of directories



where they can write files, <TT>SENDFILES</TT> means they can send files (<TT>yes</TT>



or <TT>no</TT>), and <TT>REQUEST</TT> means they can request files from your system



(<TT>yes</TT> or <TT>no</TT>). Notice the use of slashes at the end of the first



four lines, to indicate this is really a single, long line broken up for readability.



This is a typical UNIX convention.</P>



<P>A complete entry for the remote system <TT>wizard</TT> shows that it is allowed



to both send and receive files, but only from the <TT>/usr/spool/uucppublic</TT>



directory, and it can only execute <TT>mail</TT> and <TT>uucp</TT> commands (the



later transfers files):<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">MACHINE=wizard LOGNAME=uucp1 \



     COMMANDS=rmail: uucp \



     READ=/usr/spool/uucppublic: \



     WRITE=/usr/spool/uucppublic: \



     SENDFILES=yes REQUEST=yes 



</FONT></PRE>



<P>To prevent the remote system from sending files, change <TT>SENDFILES</TT> to



<TT>no</TT>. To prevent the remote system from requesting files, change <TT>REQUEST</TT>



to <TT>no</TT>.



<H3 ALIGN="CENTER"><A NAME="Heading8<FONT COLOR="#000077">A UUCP Connection</FONT></H3>



<P>When UUCP connects to a remote machine, it follows a particular series of steps.



You can better understand the configuration files used by UUCP, and the processes



that are involved, by following through a typical session. UUCP uses a process called



<TT>uucico</TT> (UUCP Call In/Call Out) to handle the process of connecting and sending



information. A UUCP connection can be started with the <TT>uucico</TT> command followed



by the remote system name, such as this:<FONT COLOR="#0066FF"></FONT>



<PRE><FONT COLOR="#0066FF">uucico -s arthur



</FONT></PRE>



<P>When <TT>uucico</TT> starts, it examines the <TT>/usr/lib/uucp/sys</TT> file (Taylor



UUCP) or <TT>/usr/lib/uucp/Systems</TT> (HDB UUCP) to see if the remote system name



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -