Internet Publishing - PPI
"Materials used in this course are the property of the author. These lessons may be used only by course participants for self-study purposes. Application for permission to use these materials for other educational purposes such as for teaching or as a basis for teaching should be directly submitted to the author."
This lesson deals with file servers based on FTP - File Transfer Protocol. This service is not described in the he textbook, and this lesson is therefore given in a more "textbook" format than the other lessons. Much of the material is taken from the book: Managing INTERNET Information Services, by Liu, Peek, Jones, Buus & Nye, published by: O'Reilly & Associates.
Contents:
10 FTP Service
10.1 Access to the archives
10.2 Security
10.3 FTP Server
10.3.1 The Server Program
10.3.2 The Archive
10.3.3 Rights - Access to Directories
10.4 FTP Client
10.4.1 Transfering
10.4.2 Saving or Displaying of Files
10.5 FTP Protocol
10.5.1 User Commands
10.5.2 Protocol Commands
10.6 Exercise
10.6.1 Downloading FTP Servers
10.6.2 Setting Up the Server
10.6.3 Simple HTML Test
Enquiries to FTP sites make up most of the traffic, by volume, on the Internet. Statistics from the US in 1994 show that 36 percent of all traffic on the Net was FTP traffic.
FTP is also one of the most widespread services, almost all machines connected to the Internet run either a client, a server or both.
FTP stands for File Transport Protocol and is also the protocol used by a file transfer service which transfers files between client and server. The service itself is often called FTP.
FTP transfers files in general, without regard to the files' contents. They can be text files, images, sound, program code - anything at all.
10.2 Security 10.3 FTP Server 10.4 The FTP Client 10.5 FTP Protocol 10.6 Exercise
There are two types of access to files on a FTP server:
10.1 Access to Archives 10.3 FTP Server 10.4 The FTP Client 10.5 FTP Protocol 10.6 Exercise
User FTP can constitute a security risk. This may at first sound incomprehensible because a password is required. However, because a distant user gives a password means that users operating between the two machines can, in principle, trap the password since it is sent unencrypted through the network. With such a password, it would be possible to log in on the same machine using Telnet - and therewith have regular user access to the machine.
For Anonymous FTP, a special area is set up to which the users have access. This does not give them access to the entire directory tree on the machine.
FTP archives can contain all kinds of file types. This is one of the strengths of the FTP archive - but unfortunately, it is also one of its threats. This characteristic makes it very easy for anonymous users to upload "unlawful" files without having to identify themselves - and it would be a big undertaking to check all the files which are uploaded. These "illegal" files can be pirate copies of software, or data files with undesirable/illegal contents (i.e. pornography).
10 FTP Service 10.1 Access to Archives 10.2 Security 10.4 The FTP Client 10.5 FTP Protocol 10.6 Exercise
Most FTP servers run on UNIX machines, and the description provided here will try to reflect this, even though the exercises in this lesson are based on MS Windows servers.
The FTP server consists of two parts, the server program and the archive.
10 FTP Service 10.1 Access to Archives 10.2 Security 10.4 The FTP Client 10.5 FTP Protocol 10.6 Exercise
The server program normally has functions for
Some FTP servers have additional characteristics which make it possible to:
A UNIX implementation which has these additional characteristics, and which is freely accessible, is Washington University's FTP Deamon, WU Archive FTP.
10 FTP Service 10.1 Access to Archives 10.2 Security 10.3 FTP Server 10.4 The FTP Client 10.5 FTP Protocol 10.6 Exercise
For UNIX systems there are some rules for how the directory structures for FTP servers should be built. This is applicable for especially for the programs which make up the commands and the password file for the server. UNIX has a user defined as ftp. With anonymous logins the FTP server uses the ftp user's log-on directory as the root directory for the FTP server. Under this directory there should now be the following directory structure:
For MSWindows based FTP servers, it is usual to assign each user his own start (or root) directory.
Often, we find separate directories for distribution and for incoming files. See below.
10 FTP Service 10.1 Access to Archives 10.2 Security 10.3 FTP Server 10.4 The FTP Client 10.5 FTP Protocol 10.6 Exercise
Most FTP servers have the capability to differentiate between the rights each user has.
For directories used for distribution, for example, dist, users do not usually have write access. This is also true for pub directories. This is done to ensure that no one switches out the files intended for distribution.
If we wish to let the users add files, upload, they must be given write access to the appropriate directory, for example, incoming. It might be wise to close incoming for reading and even for listing of filenames. If this is not done, others will be able to voluntarily write over files in the directory. It is common for a user uploading files to such a directory, to send e-mail to the administrator of the FTP archive and ask that these files be made accessible. The administrator can then check the files and copy them over to the appropriate directory and therewith control the contents of the archive.
10 FTP Service 10.1 Access to Archives 10.2 Security 10.3 FTP Server 10.5 FTP Protocol 10.6 Exercise
There are many different FTP clients. Some are terminal oriented, with a given command set. Others are based upon a graphical interface. The clients are equipped, in different degrees, with capabilities to displaying the files which are transferred. Do we need to take this into account when installing and administering the FTP server? Actually, no, but it would be a good idea to be able to compare the suitability of a FTP archive against the transfer of files with the HTTP protocol which is used by WWW clients.
Steadily, more and more are using WWW clients which support both http and for the ftp protocol. This means two things:
So, if I am running a web-server, and I also want to offer a general file distribution service, what should I choose:
In order to find the answer to this question, the following aspects must be looked at:
Graphical clients will in larger or smaller degrees utilize the capabilities offered by the FTP protocol, when these run a standard selection of the FTP protocols's capabilities, for example menus. Users very familiar with FTP (and UNIX) probably will prefer a terminal based interface, while MS Windows users will prefer a graphical client.
10 FTP Service 10.1 Access to Archives 10.2 Security 10.3 FTP Server 10.4 The FTP Client 10.5 FTP Protocol 10.6 Exercise
Transferring files to or from the client can occur in two ways:
On terminal based clients, there are commands for switching between these two modes. In the graphical interface, there exists (hopefully) a menu selection or radio button to choose the transfer form. The standard value for a server not otherwise notified, is to use the 7-bit transfer method. (Just the same, clients can send the command for binary transfer as default.)
Additionally, it is possible to choose to transfer several files at once, mget and mput in the terminal based interface for FTP. For graphical clients this is done by marking several files, and thereafter choosing the transfer function. This function varies for client to client. Some have a button with an arrow showing direction for transfer, others use "drag and drop" techniques between windows.
FTP is based upon TCP, and that means that there is a mechanism to ensure that the files' contents do not contain errors.
10 FTP Service 10.1 Access to Archives 10.2 Security 10.3 FTP Server 10.4 The FTP Client 10.5 FTP Protocol 10.6 Exercise
A standard terminal based FTP client will save received files in its own file system.
Some clients can be set up to start viewers (display programs) which displays certain file formats. Associations must be set up between the file types and viewers? Example: If a filename ends with .txt or .text, we may assume that this is a textfile. If possible the ftp-client could be set up to start a textviewer to display this file for the user.
Some programs are combined viewers and transfer clients. Netscape is an example. Netscape will display the contents of a transferred file if the file has a format recognized by Netscape. These can be, for example text files or html files. HTTP uses the MIME standard to announce the file type, FTP does not - it has to use the file name.
If files are transferred which the transferring program can not display, a natural choice (or suggestion) will be save to file for the client. Alternatively, the technique with associations, which calls the appropriate viewers, can be employed.
10 FTP Service 10.1 Access to Archives 10.2 Security 10.3 FTP Server 10.4 The FTP Client 10.6 Exercise
It may be useful to know a little more about the FTP protocol when planning to run a FTP server because the log from the server is printed out with the commands and any responses which are used by this protocol. It may be wise to differentiate between:
The figure shows these relationships:
A FTP server can service many clients simultaneously. The FTP server receives requests from the clients at TCP port number 21. After such a request, a program is set up which communicates with the client over an available TCP port. In this way, the FTP server is again ready to service new requests at port 21.
10 FTP Service 10.1 Access to Archives 10.2 Security 10.3 FTP Server 10.4 FTP Client 10.5 FTP Protocol 10.6 Exercise
Common user commands include file system operations. The example below applies to the FTP client on UNIX System V/386 Release 3.2:
ftp>? Commands may be abbreviated. Commands are: ! debug mget quit site $ dir mkdir quote size account disconnect mls recv status append form mode reget struct ascii get modtime remotehelp sunique bell glob mput remotestatus system binary hash newer rename tenex bye help nlist reset trace case idle nmap restart type cd image ntrans rhelp umask cdup lcd open rmdir user chmod ls prompt rstatus verbose close macdef proxy runique ? cr mdelete put send delete mdir pwd sendport ftp>
10 FTP Service 10.1 Access to Archives 10.2 Security 10.3 FTP Server 10.4 The FTP Client 10.5 FTP Protocol 10.6 Exercise
The FTP commands we will look at here are not the user commands above, but the commands which apply for the TCP connection in the protocol at port 21 between client and server, see the figure above. The commands and replies here are defined with ASCII characters and end with CR, LF. The clients will generate one or more protocol commands from the user commands in order to fulfill the user's wishes.
FTP commands consist of 3 or 4 ASCII characters (Uppercase) with the following arguments and CR, LF ending. Here are the most common FTP commands:
10 FTP Service 10.1 Access to Archives 10.2 Security 10.3 FTP Server 10.4 The FTP Client 10.5 FTP Protocol
In this exercise, you will download a FTP server which can run on your local machine.
I have used WinFTP which is a server under MS Windows. Download this server, or find another if you are running another operating system.
Unpack the server in its own directory. Read the information about the file ctl3v2.dll in the README.TEXT file and copy this if necessary.
Create a start directory for your FTP-archive. Set up your FTP-server with the ability for anonymous FTP with read and list access in this directory.
Set up a log file for the FTP server.
Try out the server with your FTP client. (You could run the server and the client on the same machine. This seems unnecessary with regard to transferring files, but the reason here is to learn the principles behind FTP, of course!)
Try the following situations:
Place some files in the login directory to anonymous, for example:
Create a simple html file with the name TRYFTP.HTM for use in a web client, for example Netscape, where you create a simple text and links to these three files where you, in the URL, use the FTP protocol to download them. You must have both HTTPD and FTPD running simultaneously when trying TRYFTP.HTM.
What should be turned in: TRYFTP.HTM. Due date: 27. May 1997
10 FTP Service 10.1 Access to Archives 10.2 Security 10.3 FTP Server 10.4 The FTP Client 10.5 FTP Protocol 10.6 Exercise