691-693.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 128 行
HTML
128 行
<HTML>
<HEAD>
<TITLE>Linux Unleashed, Third Edition:UUCP</TITLE>
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0672313723//-->
<!--TITLE=Linux Unleashed, Third Edition//-->
<!--AUTHOR=Tim Parker//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Sams//-->
<!--CHAPTER=39//-->
<!--PAGES=691-693//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="689-691.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="693-695.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H3><A NAME="Heading7"></A><FONT COLOR="#000077">Login Scripts</FONT></H3>
<P>The login scripts that form part of the <TT>/usr/lib/uucp/sys</TT> or <TT>/usr/lib/uucp/Systems</TT> file can be the most difficult part of a UUCP connection to set correctly. If the machine you are logging in to is a typical UNIX system, there should be only the usual login and password prompts to worry about. Other systems may require some special handling to gain access. For this reason, the login script is worth a quick look.</P>
<P>Generally, the layout of the login script is in a pattern-action pair, with the pattern coming from the remote machine and the action from the local. A simple login is as follows:</P>
<!-- CODE SNIP //-->
<PRE>
login: merlin password: secret1
</PRE>
<!-- END CODE SNIP //-->
<P>In this case, the local system waits until it sees the string <TT>login:</TT> coming from the remote, sends <TT>merlin</TT>, waits for <TT>password:</TT>, then sends <TT>secret1</TT>. You can simplify the script a little by cutting out extra letters from the remote, because all you really need are the last couple of characters and the colon. The script could be written like this:</P>
<!-- CODE SNIP //-->
<PRE>
gin: merlin word: secret1
</PRE>
<!-- END CODE SNIP //-->
<P>This type of script has a good use. Suppose the remote system sends <TT>Login:</TT> instead of <TT>login:</TT>; then the shortened form will work and the longer match won’t.</P>
<P>One useful feature of the <TT>uucico login</TT> script is the ability to wait for the remote machine to reset itself (or start a <TT>getty</TT> process, more likely). This is implemented by using a hyphen and the word <TT>BREAK</TT> in the script which tells <TT>uucico</TT> to send a break sequence if the remote site hasn’t responded in a timely manner. For example, the script would be similar to this:</P>
<!-- CODE SNIP //-->
<PRE>
ogin:-BREAK-ogin: merlin sword: secret1
</PRE>
<!-- END CODE SNIP //-->
<P>In this case, if the remote machine doesn’t respond with a <TT>login</TT>: prompt after a short period of time, the local machine sends a break sequence and waits for the prompt again.</P>
<P>A few special characters can be used in the login script. The most important ones for most UUCP purposes are the following:</P>
<CENTER>
<TABLE WIDTH="80%"><TR>
<TD WIDTH="30%"><TT>\c</TT>
<TD WIDTH="70%">Suppresses sending carriage return (send only)
<TR>
<TD><TT>\d</TT>
<TD>Delays one second (send only)
<TR>
<TD><TT>\p</TT>
<TD>Pauses for a fraction of a second (send only)
<TR>
<TD><TT>\t</TT>
<TD>Sends a tab (send and receive)
<TR>
<TD><TT>\r</TT>
<TD>Sends a carriage return (send and receive)
<TR>
<TD><TT>\s</TT>
<TD>Sends a space (send and receive)
<TR>
<TD><TT>\n</TT>
<TD>Sends a newline (send and receive)
<TR>
<TD><TT>\\</TT>
<TD>Sends a backslash (send and receive)
</TABLE>
</CENTER>
<P>Sometimes you need to use one or more of the characters to get the remote machine to respond to a modem login. For example, the following script sends a carriage return-line feed pair before starting to match characters:
</P>
<!-- CODE SNIP //-->
<PRE>
\n\r\p ogin: merlin word: secret1
</PRE>
<!-- END CODE SNIP //-->
<P>This is usually enough to get the remote machine to start a <TT>getty</TT> on the port.</P>
<H3><A NAME="Heading8"></A><FONT COLOR="#000077">Changing Access Times</FONT></H3>
<P>Both Taylor and HDB UUCP versions let you specify a time to call the remote systems. Although the examples so far show <TT>Any</TT> (meaning the system can be called at any time, day or night), you may want to restrict calls to local-cost times or to certain days of the week. The reason for limiting calls may be at your end (costs, for example) or at the remote (limited access times during the day, for example).</P>
<P>To specify particular days of the week to allow calls, use a two-digit abbreviation of the day (<TT>Mo</TT>, <TT>Tu</TT>, <TT>We</TT>, <TT>Th</TT>, <TT>Fr</TT>, <TT>Sa</TT>, <TT>Su</TT>), <TT>Wk</TT> for weekdays (Monday through Friday), <TT>Any</TT> (for any time), or <TT>Never</TT> (for not allowed to connect). Any combination of the days may be used, as you will see in a moment. The times for connecting are specified as a range, in 24-hour format, when a time span is required. If no time is given, it is assumed that any time during the day is allowed.</P>
<P>Dates and times are run together without spaces, while subsequent entries are separated by commas. Examples of restricted access times are as follows:</P>
<!-- CODE SNIP //-->
<PRE>
Wk1800-0730
MoWeFr
Wk2300-2400, SaSu
</PRE>
<!-- END CODE SNIP //-->
<P>The first example allows connection only on weekdays between 6 p.m. and 7:30 a.m. The second allows connection any time on Monday, Wednesday, or Friday. The last example allows connections only between 11 p.m. and midnight on weekdays and any time on weekends. You can build up any time and date specifications you want. These apply to both Taylor and HDB UUCP versions.
</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="689-691.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="693-695.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?