📄 tyt06fi.htm
字号:
Name (uofo:username): anonymous331 Guest login ok, send userID as password.Password: tparker230 Guest login ok, access restrictions apply.ftp> <Ctrl+d>tpci_hpws4-2></FONT></PRE><P>If the remote system is set to enable anonymous logins, you are prompted for a password and then given a warning about access limitations. If there is a file on the remote system you require, a get command transfers it. Anonymous FTP sites are becoming common, especially with the popularity of the Internet.<BR><BR><A ID=E69E89 NAME=E69E89></A><H4 ALIGN=CENTER><CENTER><FONT SIZE=4 COLOR=#FF0000><B>FTP Servers</B></FONT></CENTER></H4><BR><P>Most UNIX machines act as FTP servers by default. To provide FTP server facilities, they run the daemon ftpd when the operating system is booted. The daemon is usually handled by the UNIX inetd process. When you start using inetd, the inetd daemon watches the TCP command port (channel 21) for an arriving request for a connection, then starts ftpd to service that request. If you want to ensure that your UNIX or Linux system can handle FTP requests, make sure the ftpd daemon can be started when needed by inetd by checking the inetd configuration file (usually /etc/inetd.config or /etc/inetd.conf) for a line that looks like this:<BR><BR><PRE><FONT COLOR=#000080>ftp stream tcp nowait root /usr/etc/ftpd ftpd -l</FONT></PRE><P>If this line doesn't exist, you should add it. With most UNIX systems this line is already in the inetd configuration file, although it might be commented out, in which case you should remove the comment symbol.<BR><P>Windows, Windows for Workgroups, and Windows 95 all lack an FTP server program as part of their distribution software (although Windows 95 does have an FTP client), so you have to add a commercial package. Many commercial TCP/IP suites include an FTP server process. Figure 6.10 shows the NetManage ChameleonNFS program group, which includes an FTP server program you can use as an example for Windows for Workgroups and Windows 3.<I>x</I> machines.<BR><P><B><A HREF=06tyt10.gif>Figure 6.10. The NetManage FTP Server dialog </B><B>handles the FTP server process.</A></B><BR><P>To start the NetManage FTP Server software, double-click the FTP server icon in the NetManage program group. A dialog, shown in Figure 6.10, appears. The FTP server process is now active, and anyone on another machine on your local area network can now connect to your machine, assuming they have access.<BR><P>Access to your FTP service is controlled through the user lists maintained by the FTP Server package. Selecting the Users menu option from the NetManage FTP Server dialog opens the Users dialog, shown in Figure 6.11. This lets you add user names to your system. If another user on a different machine tries to connect to your FTP server software, the server verifies that their login name and password match the name and password you enter in this dialog. This lets you set up a list of users who can transfer files to and from your system, as long as the FTP server is running.<BR><P><B><A HREF=06tyt11.gif>Figure 6.11. Access to your machine is controlled </B><B>through the FTP Server Users dialog.</A></B><BR><P>If you are running an FTP server process, it is often a good idea to create a directory just for FTP. Many users prefer to create a directory called public, which is where all files to be transferred in and out of the local system are placed. This lets you prevent accidental deletion or transfer of files in other directories on your system, as well as providing you with the opportunity to filter incoming material for suitability, viruses, and so on. If you use a transfer directory, check it regularly and make sure all users who have access to your system can work only in that directory.<BR><P>If you want to provide an anonymous or guest account for users on your LAN or any other network that can connect to your machine, you should set up an account with either no password or a simple password like guest. It is very important to restrict the areas a guest or anonymous login can use.<BR><P>As mentioned earlier, Windows 95 is supplied with client FTP software but not an FTP server. You can use other aspects of Windows 95 as a file transfer system, such as file and print sharing over any existing network, but these do not use FTP. If you want to set up an FTP server on your Windows 95 machine, you have to install third-party commercial software for this purpose.<BR><P>A popular Windows 95 FTP server package called FTP Serv-U was written by Rob Beckers and is provided as shareware. An executable file called Serv-U starts the server. To control access to your Windows 95 system, you can set up logins using the Serv-U Users menu option. This displays a screen that lets you add logins and passwords, as well as the directories and drives the user has access to. Figure 6.12 shows the Edit User/Group dialog with a user being added. When a user from another system logs into your Windows 95 machine, they are asked for a login and password.<BR><P><B><A HREF=06tyt12.gif>Figure 6.12. Set up all users of your FTP server </B><B>with the Edit User/Group dialog.</A></B><BR><BR><A ID=E68E61 NAME=E68E61></A><H3 ALIGN=CENTER><CENTER><FONT SIZE=5 COLOR=#FF0000><B>Trivial File Transfer Protocol (TFTP)</B></FONT></CENTER></H3><BR><P>The Trivial File Transfer Protocol (TFTP) is one of the simplest file transfer protocols in use. It differs from FTP in two primary ways: it does not log onto the remote machine, and it uses the User Datagram Protocol (UDP) connectionless transport protocol instead of TCP. By using UDP, TFTP does not monitor the progress of the file transfer, although it does have to employ more complex algorithms to ensure proper data integrity. By avoiding logging onto the remote, user access and file permission problems are avoided. TFTP uses the TCP port identifier number 69, even though TCP is not involved in the protocol.<BR><P>TFTP has few advantages over FTP. It is not usually used for file transfers between machines where FTP could be used instead, although TFTP is useful when a diskless terminal or workstation is involved. Typically, TFTP is used to load applications and fonts into these machines, as well as for bootstrapping. TFTP is necessary in these cases because the diskless machines cannot execute FTP until they are fully loaded with an operating system. TFTP's small executable size and memory requirements make it ideal for inclusion in a bootstrap, where the system requires only TFTP, UDP, and a network driver, all of which can be provided in a small EPROM.<BR><P>TFTP handles access and file permissions by imposing restraints of its own. On most UNIX systems, for example, a file can be transferred only if it is accessible to all users on the remote (both read and write permissions are set). Because of the lax access regulations, most system administrators impose more control over TFTP (or ban its use altogether); otherwise, it is quite easy for a knowledgeable user to access or transfer files that could constitute a security violation.<BR><P>TFTP transfers can fail for many reasons, because practically any kind of error encountered during a transfer operation causes a complete failure. TFTP does support some basic error messages, but it cannot handle simple errors such as insufficient resources for a file transfer or even a failure to locate a requested file.<BR><BR><A ID=E69E90 NAME=E69E90></A><H4 ALIGN=CENTER><CENTER><FONT SIZE=4 COLOR=#FF0000><B>TFTP Commands</B></FONT></CENTER></H4><BR><P>The important instructions in TFTP's command set are shown in Table 6.7. The TFTP command set is similar to FTP's, but it differs in several important aspects because of the connectionless aspect of the protocol. Most noticeable is the connect command, which simply determines the remote's address instead of initiating a connection.<BR><BR><P ALIGN=CENTER><CENTER><FONT COLOR=#000080><B>Table 6.7. TFTP's command set.</B></FONT></CENTER><BR><CENTER><TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 CELLPADDING=3><TR><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P><B><I>TFTP Command</I></B></FONT><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P><B><I>Description</I></B></FONT><TR><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>binary<BR></FONT><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>Use binary mode for transfers<BR></FONT><TR><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>connect<BR></FONT><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>Determine the remote's address<BR></FONT><TR><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>get<BR></FONT><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>Retrieve a file from the remote<BR></FONT><TR><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>put<BR></FONT><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>Transfer a file to the remote<BR></FONT><TR><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>trace<BR></FONT><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>Display protocol codes<BR></FONT><TR><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>verbose<BR></FONT><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P>Display all information</FONT></TABLE></CENTER><BR><P>TFTP enables both text and binary transfers, as does FTP. As with both Telnet and FTP, TFTP uses a server process (tftpd on a UNIX system) and an executable, usually called tftp. A sample TFTP session on a UNIX host is shown here, with full trace options and binary transfers turned on:<BR><PRE><FONT COLOR=#000080>tpci_hpws1-1> tftptftp> connect tpci_hpws4tftp> tracePacket tracing on.tftp> binaryBinary mode on.tftp> verboseVerbose mode on.tftp> statusConnected to tpci_hpws4.Mode: octet Verbose: on Tracing: onRexmt-interval: 5 seconds, Max-timeout: 25 secondstftp> get /usr/rmaclean/docs/draft1getting 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> quittpci_hpws1-2></FONT></PRE><P>In the session above, you can see that the trace and verbose commands turn on the echoing of the instructions flowing between the two machines during a file transfer. Every time a block of data is sent after the get command is issued (the send ACK instruction shown on the session above), a received instruction is returned to acknowledge the ACK.<BR><P>TFTP is available on all UNIX systems as well as in TCP/IP suites for other operating systems. Figure 6.13 shows the TFTP utility from ChameleonNFS, which lets you enter the remote host name, the remote and local filenames, and the type of transfer you want. The file transfer is then performed in the background using UDP.<BR><P><B><A HREF=06tyt13.gif>Figure 6.13. Using TFTP to transfer a file.</A></B><BR><BR><A ID=E69E91 NAME=E69E91></A><H4 ALIGN=CENTER><CENTER><FONT SIZE=4 COLOR=#FF0000><B>TFTP Packets</B></FONT></CENTER></H4><BR><P>TFTP uses UDP as a transport protocol, so TFTP can use the UDP header to encapsulate TFTP protocol information. TFTP uses the UDP source and destination port fields to set the two ends of the connection. It accomplishes this by the use of <I>TFTP Transfer Identifiers, </I>or TIDs, which are created by TFTP and passed to UDP, which then places them in the headers.<BR><P>As with Telnet and FTP, TFTP uses port binding, where the sending machine selects a TID, and the remote is set to port number 69 (TFTP's port number). The remote machine responds with an acknowledgment of a connection request, a source port of 69, and the destination TID sent in the request.<BR><P>TFTP uses five types of Protocol Data Units, which are referred to as packets in the TFTP lexicon. These packets are listed in Table 6.8. Their layout is shown in Figure 6.14. Error messages supported by TFTP are shown in Table 6.9.<BR><P><B><A HREF=06tyt14.gif>Figure 6.14. TFTP packet layouts.</A></B><BR><BR><P ALIGN=CENTER><CENTER><FONT COLOR=#000080><B>Table 6.8. TFTP Protocol Data Unit codes.</B></FONT></CENTER><BR><CENTER><TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 CELLPADDING=3><TR><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P><B><I>Code</I></B></FONT><TD BGCOLOR=#80FFFF><FONT COLOR=#000080><P><B><I>OpCode</I></B></FONT><TD BGCOLOR=#80FFFF><
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -