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

📄 285-288.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 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=285-288//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="../ch14/281-284.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="288-290.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H2><A NAME="Heading1"></A><FONT COLOR="#000077">Chapter 15<BR>FTP and Telnet

</FONT></H2>

<P><I>by Tim Parker</I></P>

<DL>

<DT><B>In This Chapter</B>

<DT>&#149;&nbsp;&nbsp; FTP

<DT>&#149;&nbsp;&nbsp; Setting up FTP server service

<DT>&#149;&nbsp;&nbsp; Using FTP

<DT>&#149;&nbsp;&nbsp; Trivial file transfer protocol (TFTP)

<DT>&#149;&nbsp;&nbsp; Using Telnet

</DL>

<P>Two of the most useful tools for communicating with other Linux and UNIX systems (or any operating system, for that matter) are FTP (for transferring files) and Telnet (for logging in to other systems). In this chapter we&#146;ll look at how you can use both tools, as well as mention TFTP, which is a simplified version of FTP.

</P>

<H3><A NAME="Heading2"></A><FONT COLOR="#000077">FTP</FONT></H3>

<P>There are two different ways to use FTP and TFTP: through a command line or through a graphical interface. Most Linux systems are restricted to character-based commands unless you find a shareware or commercial GUI product. GUI-based FTP clients are much more common on Windows machines. Both character and GUI versions accomplish exactly the same task (the transfer of files from one machine to another) but do it through a different user interface. We&#146;ll concentrate on the character-based versions here because that&#146;s what most Linux systems provide.

</P>

<P>When it comes to what the function of FTP is and what FTP does, the name essentially says it all: File Transfer Protocol. FTP was developed specifically to provide a method of transferring files from one machine to another without needing complex communications protocols like XMODEM, YMODEM, ZMODEM, or Kermit, as well as removing the need to log in to the remote machine fully. FTP provides a quick method of logging into the remote machine, moving about the file system (subject to permissions, of course), and transferring files either to or from the remote system quickly.</P>

<P>To use FTP to transfer files, the machine you are running (the client) must have FTP client software. Linux and UNIX machines almost always have the FTP client software included as part of their basic distribution system. The other end of the connection&#151;the machine you want to connect to&#151;is called the server, and it must be running a program that accepts incoming FTP requests. This is called the FTP server and usually must be running all the time for FTP connections to work.</P>

<P>Multitasking operating systems like Linux usually have the FTP server program included as part of the basic distribution. In most cases, the server is called &#147;<TT>ftpd</TT>,&#148; which stands for FTP daemon. (A <I>daemon</I> is a program that operates in the background while a machine is running.) The <TT>ftpd</TT> daemon is almost always loaded automatically as part of the Linux boot process, unless the system administrator explicitly removes it.</P>

<P>If you are connecting to a PC (running OS/2, Windows, Windows 95, NetWare, or a similar operating system) or a Macintosh server, chances are the server will not have FTP server software running by default. When these operating systems are installed, they lack most of the TCP/IP services. The system administrator must activate them explicitly. Without the server software running on a PC, you can&#146;t connect to the server with your FTP client.</P>

<P>Most TCP/IP packages for PCs and Macintoshes include a server program for FTP that enables other users to connect to that machine. Indeed, most TCP/IP packages have both the FTP client and FTP server software as part of the distribution, enabling you to set your machine up as both a client and a server to others (assuming you want to allow others access to your file system).</P>

<H3><A NAME="Heading3"></A><FONT COLOR="#000077">Setting Up FTP Server Service</FONT></H3>

<P>Before we look at how to connect and transfer files from another machine (the server), we should mention how you can set up your machine as an FTP server. You may have to do this on the remote machine, too. Each machine that is to accept transfer requests must have the FTP server software active. This is pretty easy to do, as you will see in a moment. You can also set up your existing machine as an FTP server, allowing other machines on the network to connect into your system and transfer files.

</P>

<P>All the clients and server software programs you might need are included as part of the Linux distribution (although it must be installed, of course). It doesn&#146;t matter whether you are setting up access-controlled or anonymous FTP services because the basic steps you follow to install and configure the FTP daemon are the same.</P>

<P>The configuration process starts with choosing an FTP site name. You don&#146;t really need a site name, although it can make it easier for remote users to find your system, especially if they are using an anonymous login. FTP site names are usually of the general format</P>

<!-- CODE SNIP //-->

<PRE>

ftp.domain_name.domain_type

</PRE>

<!-- END CODE SNIP //-->

<P>where <TT>domain_name</TT> is the domain name (or an alias) of the FTP server&#146;s domain, and <TT>domain_type</TT> is the usual DNS extension. For example, if you have an FTP site named</P>

<!-- CODE SNIP //-->

<PRE>

ftp.tpci.com

</PRE>

<!-- END CODE SNIP //-->

<P>it is clear that this is the FTP server for anyone accessing the <TT>tpci.com</TT> domain.</P>

<P>The FTP daemon, called <TT>ftpd</TT>, must be started. Usually, the <TT>inetd</TT> process starts the FTP daemon by watching the TCP command port (channel 21) for an arriving request for a connection. Then it starts <TT>ftpd</TT> to service that request.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>Note:&nbsp;&nbsp;</B><BR>Make sure that <TT>ftpd</TT> can be started when needed by <TT>inetd</TT> by checking the <TT>inetd</TT>configuration file (usually <TT>/etc/inetd.config</TT>) for a line that looks like this:

<!-- CODE SNIP //-->

<PRE>

ftp  stream  tcp  nowait  root  /etc/ftpd ftpd

</PRE>

<!-- END CODE SNIP //-->

<P>If this line doesn&#146;t exist, add it. With most Linux and UNIX systems, this line is already in the <TT>inetd</TT> configuration file, although it may be commented out&#151;in which case you should remove the comment symbol.<HR></FONT>

</BLOCKQUOTE>

</P>

<P>The <TT>ftp</TT> entry in the <TT>inetd</TT> configuration file tells <TT>inetd</TT> that FTP is to use TCP and that it should spawn <TT>ftpd</TT> every time a new connection is made to the <TT>ftp</TT> port. The <TT>ftpd</TT>daemon can be started with the <TT>-l</TT> option attached, which enables logging. You can ignore this option if you want as long files get quite large, quickly.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="../ch14/281-284.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="288-290.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 + -