What is FTP?

FTP is an acronym for File Transfer Protocol. FTP is a client/server application that allows the transfer of files between computers. This transfer can take place between a mainframe and a local terminal, or as a transfer of information over the Internet between your computer and a distant server. FTP is a powerful application which allows users to access archives that are available on a large number of computer hosts. The key elements of FTP are:

finding FTP sites from your client based system
establishing a connection with the server
developing an ability to search through "archives" to retrieve information
using FTP commands to facilitate the transfer of information
allowing for the differences in file types and compressions techniques.
The idea of client/server is important here - that you, the "local" client, are initiating a communication pathway with a "remote" server that may contain public information of interest to you.
We will look at some of the basic commands and tools for FTP, and then point to other sources for a more detailed discussion of the subject matter.

We will begin our discussion of FTP with an explanation of some of the commands used in Unix FTP, in order to develop an understanding of what is happening underneath the screen interface. We will then discuss the more user-friendly GUI applications for Windows and Macintosh.


FTP for UNIX

Basic Commands
Since UNIX is a command line environment, we should introduce some of the basic commands that are used to establish an FTP session and to instruct the server on what the client is requesting. Some of the most commonly used commands are:

open initiates the session between the client and the server
nlist, dir, ls list the heirarchical organization of files on the remote server
cd allows you to change directories on the remote computer either up or down
pwd gives the client a chance to view the current directory and pathway on the remote host
lls, lcd, lpwd are the ways in which you can do the above for managing your local files
get allows you to retrieve a file from the server down to your local client computer.
put allows you to place a file from your client up to the remote server computer.
mput/mget are the same as above but allow for multiple files to be manipulated with a single command
prompt sets interactive prompting; "on" is a safety feature prompting you for verification of each step of the multiple commands, "off" allows the commands to act unimpeded
ascii/binary allows to specify the type of file to be transferred
quit ends the connection and ends the session.
To find the full array of commands, type help or ? at the FTP> prompt. This will instruct ruby to show all the available commands for effective FTP use; the above list is by no means exhaustive but does give the most commonly used commands.
Initiating a Session
For the sake of example we will assume that you are attempting to establish an FTP session from your Ruby account (your account on the SILS server) to another remote server computer (sunsite.unc.edu, for example). Once you have logged into Ruby, you could then start an ftp session by simply typing ftp at the prompt. The prompt then changes to look like: ftp>. At this you can then type: open sunsite.unc.edu. If you have an account on sunsite (or whatever remote computer you are connecting to), you can login with your username and password. If you don't, some servers allow anonymous ftp sessions, which simply means that you use 'anonymous' as your userid and your email address as your password when logging in to the remote comuter. A typical login, with client commands emboldened, is shown:

~ % ftp
ftp>open sunsite.unc.edu
Connected to sunsite.unc.edu.
220-
220 calzone FTP server (Version wu-2.4(4) Mon Jan 13
16:10:34 EST 1997) ready.
Name (sunsite.unc.edu:stear):anonymous
331 Guest login ok, send your complete e-mail address
as password.
Password:
230 Guest login ok, access restrictions apply.
ftp>

Getting What You Want
Once in any FTP server, you can navigate through the lists of directories and files to find out what is available. This is done by using the (l)cd, (l)ls and others like them to direct the navigation and the downloading of the files. Since the organization of directories and files is structured heirarchically, it may be easy to lose the way when looking for a document. In order to allow clients to keep up with their paths of searching, the command pwd becomes useful, prints the current (or working) directory. Before a file is requested by the client to be downloaded from the server (get command) or that the client wishes to upload onto the server (put command), two conditions must be considered
Issues concerning file permissions
Whether the file being transported is in Binary or Ascii mode
Briefly, one should view the permissions in UNIX to know for whom it is readable, writeable, and executable. These permissions can be viewed by using either the nlist or dirinfo commands. The client must also be aware if the file being transported is a text file or any other kind of file. In general, the transfer mode should be set to ascii for text-only files, and to binary for all others (including .gif, .doc, and any executable files).

Linux Servers you can also try to find the file passwd in the dir \etc\ to look it up and may you have luck and can change the file so that the root have another password without he mention it :)


FTP for Windows


The FTP application for Windows is call WS-FTP and is a GUI-based file-transfer client that allows for a much easier client/server interaction.

WS-FTP is initiated by double clicking on the icon for it in Windows 95. The session starts with a logon procedure, and then graphically represents the client and the server by two opposing tables of directories and files. By logging in you specify yourself as the local system, and allow ruby (or any other ftp server) to be the remote system. The directories can be changed easily enough, both on the remote computer and on the local client hard drive by simply clicking on the change directory button.

In order to FTP a file, one can simply look through the directories of the server to identify the file(s) of interest. You then make sure that the directory where you want to put that file in is open in your local system. You can click on either binary or ascii transfer mode, depending on what kind of file it is (you can also let the program decide by setting it to auto). Then, clicking the arrow in the direction you want the file to be transferred (client to server or vice-versa) moves the file into the other computer.

In terms of permissions, the WS-FTP program makes it very simple to set or re-set permissions. One need only to double-right click on the file of interest and choose the CHMOD command to set the permissions with the mouse.


FTP for Macintosh


FTP applications for Macintosh are unique in their feel interface, but the underlying features of file transfers between clients and servers are very similiar to the WS-FTP mentioned above.

One Macintosh application is called Fetch and is associated with a little dog running across the screen to fetch information. It has the same basic setup as Windows 95 does. The only setback it has to the Windows system is that it is not clear in showing exactly where the file is coming from and where it is going from the server, it only shows the directories for the client.

One simply needs to click on this application and the helpful GUI interface leads you through the steps for file transfer.

Another useful FTP program is called Anarchie. The basic metaphor for Anarchie is based on Finder windows. Each window corresponds to a directory on a remote ftp server. You can have multiple windows open at once, so you can interact with different ftp servers, or different directories on those servers, at the same time. You can drag and drop files between the windows and the Finder, or just double click to transfer the file. You can even upload or download entire directories by dragging and dropping a directory from or to a window!

Anarchie also has two searching facilities to find files on the internet. "Archie" searching will let you search the one of the various archie servers around the internet, which attempt to catalog a lot of files available via ftp. Anarchie also includes the ability to search the entire Info-Mac archive database, which will tell you the location of any file in the comprehensive Info-Mac library. Info-Mac is the main repository of Macintosh shareware and freeware.


Common Commands

ABOR - abort a file transfer
CWD - change working directory
DELE - delete a remote file
LIST - list remote files
MDTM - return the modification time of a file
MKD - make a remote directory
NLST - name list of remote directory
PASS - send password
PASV - enter passive mode
PORT - open a data port
PWD - print working directory
QUIT - terminate the connection
RETR - retrieve a remote file
RMD - remove a remote directory
RNFR - rename from
RNTO - rename to
SITE - site-specific commands
SIZE - return the size of a file
STOR - store a file on the remote host
TYPE - set transfer type
USER - send username
Uncommon Commands

ACCT* - send account information
APPE - append to a remote file
CDUP - CWD to the parent of the current directory
HELP - return help on using the server
MODE - set transfer mode
NOOP - do nothing
REIN* - reinitialize the connection
STAT - return server status
STOU - store a file uniquely
STRU - set file transfer structure
SYST - return system type
Descriptions

ABOR
Syntax: ABOR
Aborts a file transfer currently in progress.

ACCT*
Syntax: ACCT account-info
This command is used to send account information on systems that require it. Typically sent after a PASS command.

ALLO
Syntax: ALLO size [R max-record-size]
Allocates sufficient storage space to receive a file. If the maximum size of a record also needs to be known, that is sent as a second numeric parameter following a space, the capital letter "R", and another space.

APPE
Syntax: APPE remote-filename
Append data to the end of a file on the remote host. If the file does not already exist, it is created. This command must be preceded by a PORT or PASV command so that the server knows where to receive data from.

CDUP
Syntax: CDUP
Makes the parent of the current directory be the current directory.

CWD
Syntax: CWD remote-directory
Makes the given directory be the current directory on the remote host.

DELE
Syntax: DELE remote-filename
Deletes the given file on the remote host.

HELP
Syntax: HELP [command]
If a command is given, returns help on that command; otherwise, returns general help for the FTP server (usually a list of supported commands).

LIST
Syntax: LIST [remote-filespec]
If remote-filespec refers to a file, sends information about that file. If remote-filespec refers to a directory, sends information about each file in that directory. remote-filespec defaults to the current directory. This command must be preceded by a PORT or PASV command.

MDTM
Syntax: MDTM remote-filename
Returns the last-modified time of the given file on the remote host in the format "YYYYMMDDhhmmss": YYYY is the four-digit year, MM is the month from 01 to 12, DD is the day of the month from 01 to 31, hh is the hour from 00 to 23, mm is the minute from 00 to 59, and ss is the second from 00 to 59.

MKD
Syntax: MKD remote-directory
Creates the named directory on the remote host.

MODE
Syntax: MODE mode-character

Sets the transfer mode to one of:

S - Stream
B - Block
C - Compressed
The default mode is Stream.

NLST
Syntax: NLST [remote-directory]
Returns a list of filenames in the given directory (defaulting to the current directory), with no other information. Must be preceded by a PORT or PASV command.

NOOP
Syntax: NOOP
Does nothing except return a response.

PASS
Syntax: PASS password
After sending the USER command, send this command to complete the login process. (Note, however, that an ACCT command may have to be used on some systems.)

PASV
Syntax: PASV
Tells the server to enter "passive mode". In passive mode, the server will wait for the client to establish a connection with it rather than attempting to connect to a client-specified port. The server will respond with the address of the port it is listening on, with a message like:
227 Entering Passive Mode (a1,a2,a3,a4,p1,p2)
where a1.a2.a3.a4 is the IP address and p1*256+p2 is the port number.

PORT
Syntax: PORT a1,a2,a3,a4,p1,p2
Specifies the host and port to which the server should connect for the next file transfer. This is interpreted as IP address a1.a2.a3.a4, port p1*256+p2.

PWD
Syntax: PWD
Returns the name of the current directory on the remote host.

QUIT
Syntax: QUIT
Terminates the command connection.

REIN*
Syntax: REIN
Reinitializes the command connection - cancels the current user/password/account information. Should be followed by a USER command for another login.

REST
Syntax: REST position
Sets the point at which a file transfer should start; useful for resuming interrupted transfers. For nonstructured files, this is simply a decimal number. This command must immediately precede a data transfer command (RETR or STOR only); i.e. it must come after any PORT or PASV command.

RETR
Syntax: RETR remote-filename
Begins transmission of a file from the remote host. Must be preceded by either a PORT command or a PASV command to indicate where the server should send data.

RMD
Syntax: RMD remote-directory
Deletes the named directory on the remote host.

RNFR
Syntax: RNFR from-filename
Used when renaming a file. Use this command to specify the file to be renamed; follow it with an RNTO command to specify the new name for the file.

RNTO
Syntax: RNTO to-filename
Used when renaming a file. After sending an RNFR command to specify the file to rename, send this command to specify the new name for the file.

SITE*
Syntax: SITE site-specific-command
Executes a site-specific command.

SIZE
Syntax: SIZE remote-filename
Returns the size of the remote file as a decimal number.

STAT
Syntax: STAT [remote-filespec]
If invoked without parameters, returns general status information about the FTP server process. If a parameter is given, acts like the LIST command, except that data is sent over the control connection (no PORT or PASV command is required).

STOR
Syntax: STOR remote-filename
Begins transmission of a file to the remote site. Must be preceded by either a PORT command or a PASV command so the server knows where to accept data from.

STOU
Syntax: STOU
Begins transmission of a file to the remote site; the remote filename will be unique in the current directory. The response from the server will include the filename.

STRU
Syntax: STRU structure-character

Sets the file structure for transfer to one of:

F - File (no structure)
R - Record structure
P - Page structure
The default structure is File.

SYST
Syntax: SYST
Returns a word identifying the system, the word "Type:", and the default transfer type (as would be set by the TYPE command). For example: UNIX Type: L8

TYPE
Syntax: TYPE type-character [second-type-character]

Sets the type of file to be transferred. type-character can be any of:

A - ASCII text
E - EBCDIC text
I - image (binary data)
L - local format
For A and E, the second-type-character specifies how the text should be interpreted. It can be:

N - Non-print (not destined for printing). This is the default if second-type-character is omitted.
T - Telnet format control (<CR>, <FF>, etc.)
C - ASA Carriage Control
For L, the second-type-character specifies the number of bits per byte on the local system, and may not be omitted.

USER
Syntax: USER username
Send this command to begin the login process. username should be a valid username on the system, or "anonymous" to initiate an anonymous login.


Error Listing

110 Restart marker reply. In this case, the text is exact and not left to the particular implementation; it must read: MARK yyyy = mmmm Where yyyy is User-process data stream marker, and mmmm server's equivalent marker (note the spaces between markers and "=").
120 Service ready in nnn minutes.
125 Data connection already open; transfer starting.
150 File status okay; about to open data connection.
200 Command okay.
202 Command not implemented, superfluous at this site.
211 System status, or system help reply.
212 Directory status.
213 File status.
214 Help message. On how to use the server or the meaning of a particular non-standard command. This reply is useful only to the human user.
215 NAME system type. Where NAME is an official system name from the list in the Assigned Numbers document.
220 Service ready for new user.
221 Service closing control connection. Logged out if appropriate.
225 Data connection open; no transfer in progress.
226 Closing data connection. Requested file action successful (for example, file transfer or file abort).
227 Entering Passive Mode (h1,h2,h3,h4,p1,p2).
230 User logged in, proceed.
250 Requested file action okay, completed.
257 "PATHNAME" created.
331 User name okay, need password.
332 Need account for login.
350 Requested file action pending further information.
421 Service not available, closing control connection. This may be a reply to any command if the service knows it must shut down.
425 Can't open data connection.
426 Connection closed; transfer aborted.
450 Requested file action not taken. File unavailable (e.g., file busy).
451 Requested action aborted: local error in processing.
452 Requested action not taken. Insufficient storage space in system.
500 Syntax error, command unrecognized. This may include errors such as command line too long.
501 Syntax error in parameters or arguments.
502 Command not implemented.
503 Bad sequence of commands.
504 Command not implemented for that parameter.
530 Not logged in.
532 Need account for storing files.
550 Requested action not taken. File unavailable (e.g., file not found, no access).
551 Requested action aborted: page type unknown.
552 Requested file action aborted. Exceeded storage allocation (for current directory or dataset).
553 Requested action not taken. File name not allowed.


main page

 

Hosted by www.Geocities.ws

1