Simple Introduction to FTP Center for Academic Computing The Pennsylvania State University What is FTP? FTP (file transfer protocol) is a method for transferring files between computers attached to the Internet. Programs supporting FTP allow users to easily move files from one Internet-connected computer to another. This is done by first establishing an FTP connection between the two computers and then issuing the proper commands to effect the file transfer. In some cases you will need to have a user account on the remote computer to establish the FTP connection. Some sites allow anonymous FTP, which means that no account is needed. We explain that process below. Anonymous FTP Sometimes an institution wants to make computer files publicly available to anyone on the Internet -- without requiring them to have a computer account. For this purpose they may set up an account on their computer permitting anonymous FTP access. Many anonymous FTP file/program libraries are available on the Internet. Establishing an FTP connection to a site supporting anonymous FTP is easy. When you are prompted for a userid, you enter the word anonymous; then for a password, you enter either your local computer electronic mail address or your name. For example, if your userid is ABC101 and you have an account on PSUVM you would enter the following: user: anonymous Password: ABC101@psuvm.psu.edu If you are working from a client on your microcomputer and you have an Access account userid of XYZ999, you would enter the following: user: anonymous Password: XYZ999@psu.edu Please note that anonymous FTP sites typically do not permit users to put files on the anonymous FTP server. Contributions to an anonymous FTP server typically must be made by contacting the owner of that server. FTP Clients A client is a computer program that acts as a requester to another computer program called a server. The client provides a user interface and user commands to access information or network services from the server. Clients are developed to take best advantage of the capabilities of the local operating environment, such as mouse control, windows, etc. The best way for an individual to use FTP is with an FTP client for their computer and operating environment. For example, a user with an IBM-PS/2 and the Windows environment should acquire an FTP client that works with Windows. A user with a Macintosh should use the Dartmouth FETCH FTP client. By using the proper FTP client the user is taking advantage of the full potential of their computer system. However, FTP clients are more easily understood if the user has an understanding of generic FTP concepts. The remainder of this document will describe generic FTP. If you are using an FTP client for your operating environment you will want to read the client documentation to learn how to use FTP with that client. Establishing the FTP connection First you need to establish an FTP connection with the remote Internet host computer. This means running an FTP client and providing it with the Internet address or IP number of the host. Examples will now be provided for 3 common instances: a PS/2 at a public CAC microcomputer lab, a macintosh at a CAC public microcomputer lab, an account on PSUVM or one of the CAC SUN workstations. Establishing the FTP Connection - PS/2 at CAC Lab The software package used at the Penn State microcomputer labs is PC/TCP, marketed by a company named FTP Software, Inc. For the ease of our students the IBM-PC systems at the micro labs have a menu system to help launch programs. When you first sit down at the computer you should see a menu titled PSU MAIN MENU. This menu has a number of options which are selected by using the cursor keys to highlight them. The WINDOWS menu item is initially selected, so pressing the [ENTER] key will start the MS Windows environment. Other selections can be made by pressing the up-arrow and down-arrow keys a few times. A menu selection is chosen by highlighting it and pressing the [ENTER] key. Select the menu item HOST CONNECTION MENU. You will now see a menu of different host connection options. Select the menu item FILE TRANSFER PROGRAM. You will now be asked Enter Host Name. This is where you specify the Internet name of the desired remote host computer. An example Internet host name follows: ftp.cac.psu.edu The program will then connect with the remote host and it will ask you for a userid and password. You have now made the FTP connection Establishing the FTP Connection - Macintosh at CAC Lab The software package used at the Penn State microcomputer labs is SU-MacIP, which was developed at Stanford University. The procedure for launching SU-MacIP is as follows: ¥ On the Mac desktop open the icon named local. ¥ Open the folder named Application Launchers. ¥ Open the folder named Communications. ¥ Now double-click on the icon for SU-MacIP to launch that application. Now that you have launched SU-MacIP you will want to open the NETWORK menu and select FTP. You will be presented with a dialog box asking you to supply a host name and a user name. The host name is the Internet name of the host with which you want an FTP connection. An example of a host name is: ftp.cac.psu.edu The user name should be the userid for your account on the remote host, or the word 'anonymous' for anonymous FTP access. (See section on anonymous FTP above for more detail.) Establishing the FTP Connection - PSUVM or Sun Workstation One way to establish an FTP connection with a remote host computer from a PSUVM or Sun workstation account is by directly issuing the FTP command and specifying the Internet name of the desired host computer. An example of this is: FTP ftp.cac.psu.edu You will then be prompted to provide a user name and password. If your intent is for anonymous FTP please refer to the section on anonymous FTP earlier in this document. Navigating the Directory Structure Most computers supporting FTP have their file directories arranged in what is called a hierarchical file structure. This means that files are grouped in directories and subdirectories. Typically, when you first establish an anonymous FTP connection, you will be set to the root directory of the remote host. This is the topmost directory. It may contain files, subdirectories, or both. Issuing the DIR command at this point will retrieve for you a directory listing of the files and subdirectories on the current (root) directory. To see what is in this directory, type DIR and press the key. DIR You will then be presented with a directory listing that looks something like the following: -r--r--r-- 5 root wheel 5123 Aug 10 8:03 README drwxr-xr-x 5 root wheel 1024 May 5 10:58 bin drwxr-xr-x 5 root wheel 1024 May 5 10:58 pub drwxr-xr-x 5 root wheel 1024 May 5 10:58 etc drwxr-xr-x 5 root wheel 1024 May 5 10:58 users -r--r--r-- 5 root wheel 512 Sep 21 9:19 .profile This directory listing gives some important information. For example, the letter d in the first column of the listing indicates that this is a subdirectory under the current directory. So, you can deduce that bin, pub, etc and users are all subdirectories. The remaining listings are for the files README and .profile. You may change the current directory to one of the subdirectories through use of the CD command. The format of this command is: CD A few examples based on the above directory listing follow. Please note that upper and lower case are very important distinctions on many host computers. Thus ETC and etc are not the same thing. CD bin CD .. CD pub This method works when the subdirectory you wish to change to is located under the current directory. You may find that you have to traverse a number of subdirectory levels to find the items you want. Moving up one level in the directory tree is quite easy. Issue the CD command followed by two periods, as in: CD .. Issuing this command will move you to the directory above the current directory, making that one the new current directory. A shortcut you may want to use is to CD directly to the root directory. You may do this by means of the following command: CD / Please note that the symbol for the root directory, when used with the CD command, is / (forward slash). This is different than the \ (back slash) character used for subdirectories in DOS. Using the CD command you can now navigate around the directory structure of any host you are connected to with FTP. Changing the Local Drive or Subdirectory You may now need to change, on your local computer, the local diskette drive or subdirectory. When FTP is used at the CAC microcomputer labs it is necessary to receive files to a floppy disk. The command for changing the local drive or subdirectory is DRIVE. For example, to change to the root directory of a floppy disk in drive A: you would use the command: DRIVE A: Specifying File Type in Preparation for File Transfer Before actually transferring files, you will need to inform FTP of the file type. This type may be ASCII, meaning pure text, or BINARY, meaning other than pure text. The distinction is important, because without specifying the file type there is the chance that the file transfer will be done incorrectly and you will end up with a jumbled (and unusable) file. Once you specify a file type, that type will remain in effect until you either change it or close the FTP connection. The default (initially set) file type is ASCII. You set the file type by issuing the command ASCII or the command BINARY as in the following examples: ASCII or BINARY Some systems will have additional formats available (e.g. MacBinary) and some FTP clients have the ability to automatically determine the correct transfer format. Getting a File from a Remote Host Once you have established the FTP connection with a remote host, changed subdirectory to that which contains the file or files you want, and changed the local drive and subdirectory to the one where you want the files to reside, you are now ready to copy the files from the remote computer. The command for doing this is GET. The form of the GET command is: GET where: is the name of the file on the remote host computer is the name you want the file to have when it is copied to your local computer Putting Files on a Remote Host The steps for copying files to a remote Internet host are essentially the same as those for copying files from a remote Internet host. The exception is that you must use the PUT command instead of the GET command. The syntax of the PUT command is as follows: PUT where: is the name you want the file to have when it is copied to your local computer is the name of the file on the remote host computer Built-in FTP Help When you are connected to a remote host via FTP there is some online help available. To get this online help you would enter one of the following commands: help or ? You will then be presented with a list of available FTP commands. Please note that different hosts will support different commands, although the commands provided in this document should be available on all hosts.