📄 292-295.html
字号:
<HTML>
<HEAD>
<TITLE>Linux Unleashed, Third Edition:FTP and Telnet</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=15//-->
<!--PAGES=292-295//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="290-292.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="295-298.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading8"></A><FONT COLOR="#000077">Anonymous FTP Access</FONT></H4>
<P>FTP requires a user ID and password to enable file transfer capabilities, but there is a more liberal method of allowing general access to a file or directory called <I>anonymous FTP.</I> Anonymous FTP removes the requirement for a login account on the remote machine, usually allowing the login <TT>anonymous</TT> with a password of either <TT>guest</TT> or the user’s actual login name. The following session shows the use of an anonymous FTP system:</P>
<!-- CODE SNIP //-->
<PRE>
tpci> ftp uofo.edu
Connected to uofo.edu.
220 uofo.edu FTP server ready.
Name (uofo:username): anonymous
331 Guest login ok, send userID as password.
Password: tparker
230 Guest login ok, access restrictions apply.
ftp>
</PRE>
<!-- END CODE SNIP //-->
<P>If the remote system is set to allow anonymous logins, you will sometimes be prompted for a password and then given a warning about access limitations. If there is a file on the remote system you require, a <TT>get</TT> command will transfer it. Anonymous FTP sites are becoming common, especially with the expanding interest in the Internet.</P>
<P>If anonymous FTP is supported on a remote system, a message usually tells you exactly that. The login shown below is for the Linux FTP archive site called <TT>sunsite.unc.edu</TT>:</P>
<!-- CODE //-->
<PRE>
ftp sunsite.unc.edu
331 Guest login ok, send your complete e-mail address as password.
Enter username (default: anonymous): anonymous
Enter password [tparker@tpci.com]:
|FTP| Open
230- WELCOME to UNC and SUN’s anonymous ftp server
230- University of North Carolina
230- Office FOR Information Technology
230- SunSITE.unc.edu
230 Guest login ok, access restrictions apply.
FTP>
</PRE>
<!-- END CODE //-->
<P>After the login process is completed, you see the prompt <TT>FTP></TT>, indicating the remote system is ready to accept commands.</P>
<P>When you log on to some systems, you may see a short message containing instructions for downloading files, explaining any restrictions that are placed on anonymous FTP users, or information about the location of useful files. For example, you may see messages like this (taken from the Linux FTP site):</P>
<!-- CODE //-->
<PRE>
To get a binary file, type: BINARY and then: GET “File.Name” newfilename
To get a text file, type: ASCII and then: GET “File.Name” newfilename
Names MUST match upper, lower case exactly. Use the “quotes” as shown.
To get a directory, type: DIR. To change directory, type: CD “Dir.Name”
To read a short text file, type: GET “File.Name” TT
For more, type HELP or see FAQ in gopher.
To quit, type EXIT or Control-Z.
230- If you email to info@sunsite.unc.edu you will be sent help
information
230- about how to use the different services sunsite provides.
230- We use the Wuarchive experimental ftpd. if you “get”
<directory>.tar.Z
230- or <file>.Z it will compress and/or tar it on the fly. Using “.gz”
åinstead
230- of “.Z” will use the GNU zip (/pub/gnu/gzip*) instead, a superior
230- compression method.
</PRE>
<!-- END CODE //-->
<P>Most anonymous FTP sites are set to read-only and do not allow you to upload files (put files) to them. You are usually very restricted regarding where you can go in their file system, too.
</P>
<H3><A NAME="Heading9"></A><FONT COLOR="#000077">Trivial File Transfer Protocol (TFTP)</FONT></H3>
<P>The Trivial File Transfer Protocol (TFTP) differs from FTP in two primary ways: it does not log on to the remote machine and it uses the User Datagram Protocol (UDP) connectionless transport protocol instead of TCP. TFTP is usually not used for file transfers between machines where FTP can be used instead, although TFTP is useful when a diskless terminal or workstation is involved. Typically, TFTP is used when a file is requested from a very busy server or when it can be delivered at any time. Using TFTP is much like using email: you send a message asking for a file, and eventually the file arrives back on your system.
</P>
<P>TFTP handles access and file permissions by imposing restraints of its own. On most systems a file can be transferred using TFTP only if it is accessible to all users. Because of lax access regulations, most system administrators impose more control over TFTP or ban its use altogether.</P>
<P>The main instructions from the TFTP command set are shown in Table 15.2. Although they appear similar to the FTP command set, they differ in several important aspects because of the connectionless aspect of the TFTP protocol. Most noticeable is the <TT>connect</TT> command, which simply determines the remote’s address instead of initiating a connection.</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 15.2.</B> TFTP’s <TT>command set</TT>.
<TR>
<TH COLSPAN="2"><HR>
<TR>
<TH WIDTH="30%" ALIGN="LEFT">TFTP Command
<TH WIDTH="70%" ALIGN="LEFT">Description
<TR>
<TD COLSPAN="2"><HR>
<TR>
<TD><TT>binary</TT>
<TD>Use binary mode for transfers
<TR>
<TD><TT>connect</TT>
<TD>Determine the remote’s address
<TR>
<TD><TT>get</TT>
<TD>Retrieve a file from the remote
<TR>
<TD><TT>put</TT>
<TD>Transfer a file to the remote
<TR>
<TD><TT>trace</TT>
<TD>Display protocol codes
<TR>
<TD><TT>verbose</TT>
<TD>Display all information
<TR>
<TD COLSPAN="2"><HR>
</TABLE>
<P>TFTP enables both text and binary transfers. As with both Telnet and FTP, TFTP uses a server process (<TT>tftpd</TT> on a UNIX system) and an executable, usually called <TT>tftp</TT>. Because of the nature of TFTP, Windows and similar PC-based operating systems don’t usually support it. In most cases, TFTP is used between UNIX machines.</P>
<P>A sample character-based TFTP session is shown here, with full trace options and binary transfers turned on:</P>
<!-- CODE //-->
<PRE>
> tftp
tftp> connect tpci_hpws4
tftp> trace
Packet tracing on.
tftp> binary
Binary mode on.
tftp> verbose
Verbose mode on.
tftp> status
Connected to tpci_hpws4.
Mode: octet Verbose: on Tracing: on
Rexmt-interval: 5 seconds, Max-timeout: 25 seconds
tftp> get /usr/rmaclean/docs/draft1
getting from tpci_hpws4:/usr/rmaclean/docs/draft1 to /tmp/draft1 [octet]
sent RRQ <file=/usr/rmaclean/docs/draft1, mode=octet>
received DATA <block1, 512 bytes>
send ACK <block=1>
received DATA <block2, 512 bytes>
send ACK <block=3>
received DATA <block4, 128 bytes>
send ACK <block=3>
Received 1152 bytes in 0.2 second 46080 bits/s]
tftp> quit
</PRE>
<!-- END CODE //-->
<P>You may have to use TFTP in some cases where network conditions are bad or the server doesn’t accept standard FTP. Usually, though, FTP should be your choice of protocol.
</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="290-292.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="295-298.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -