|
|
| Using FTP |
FTP is an acronym for File Transfer Protocol. It represents a widely-used, albeit non-secure, method for transferring files between two computers. One of the computers must be set up as a host or server. The other, known as the client, is the computer that you are using.
There are two basic types of operations.
|
When you retrieve a file from the server, you are performing a "get" operation. This is also known as "downloading."
|
When you post a file to the server, your are performing a "put" operation. This is also known as "uploading."
|
When you connect to an FTP server, you must send a username and password. In many cases the username "anonymous" may be used to mean "I am a visitor." Even if you are visiting and FTP site and are not prompted for a username, the FTP server will assign the anonymous username to you. Most FTP servers ask which username you would like to use.
There are a number of programs to help transfer files using FTP. The simplest is a command line program built into most operating systems, and it has a simple name: 'ftp'. But in order to keep network sniffers from reading your password when you connect to our ftp server, we use a secure ftp server. This means that you must use a secure ftp client.
Popular FTP programs include WinSCP, CuteFTP, FileZilla, Fugu, and SmartFTP. These represent only a small fraction of of freeware FTP programs. In addition there are commercially available programs for those with too much money.
Another way to access files is to use your web browser! Simply enter the FTP address where you normally enter a web site address. The difference between web sites and FTP sites is the 'protocol identifier' used in the address. For web sites, the identifier is 'http:' while FTP sites use the identifier 'ftp:', or 'sftp:' for secure FTP. Be aware that many web browsers automatically send the username "anonymous" to the FTP server. If anonymous access is not allowed, you may be denied access until you submit a registered username and password. On Internet Explorer browsers, you may select File > Login as to be prompted for your username and password. From any browser you may include your username and password on the address bar. For example: ftp://imstudent:mypassword@major.wustl.edu/resource
Notice that the previous method leaves your username and password accessible to anyone who has access to the browser (and browser history) that you are using. Be sure to clear the browser history when you are finished with your session.
It is a good idea for new FTP users to understand command line FTP even if you plan on using a graphical FTP program. The main points are described below.
Starting the ftp program
Start the ftp program by entering ftp from your command line. On a Windows computer, select Start > Run and enter cmd on the line labeled 'Open'.
You should see an ftp prompt, typically 'ftp>'. To connect to a specific FTP server, use the 'open' command. For example: open kelso.wustl.edu
Alternatively, you may start ftp and include the name of the FTP server. For example, from the command line: ftp kelso.wustl.edu
Logging into and out of the ftp server
After connecting to the FTP server, you will be prompted for a username and password. If the server allows anonymous access, then enter the username 'anonymous' and then enter your e-mail address for the password. Otherwise, enter the username and password given to you for FTP access.
When you are done with your FTP session, log out using the 'quit' command.
File transfer types
There are several types of file transfer, most notably ASCII and binary. Most servers use binary transfer mode for all files, and most FTP client programs automatically select the correct type. If in doubt, enter the 'binary' command at the ftp prompt.
Navigating and listing directories
This part of ftp is a bit tricky. Use the 'dir' or 'ls' command to list files in the current directory on the server. Notice that this will show you files on the server, not on your computer. In some cases you will not see anything, depending on how the FTP server is set up. Some servers, including the one for this class, have 'hidden directories'. This means that the directories are there but don't automatically show up. That helps keep out some (but not all) of the riff-raff.
To change to a different directory, use the 'cd' command at the ftp prompt. For example: cd /students/path10
Notice the forward slash in front of the directory name. The slash refers to the top level of the file server. If you do not include the forward slash, the system expects the directory to exist as a subdirectory to the present directory.
The table below illustrates when to use a slash and when not to use one. The FTP 'session' is shown on the left, and a diagram of the FTP site file structure is shown on the right.
C:\Documents and Settings\stein>ftp major.wustl.edu Connected to major.wustl.edu. 220 major Microsoft FTP Service (Version 5.0). User (major.wustl.edu:(none)): test08 331 Password required for test08. Password: ******** 230 User test08 logged in. ftp> cd /resource/class/fall06 250 CWD command successful. ftp> ls 200 PORT command successful. 150 Opening ASCII mode data connection for file list. path201 path301 software 226 Transfer complete. ftp: 28 bytes received in 0.00Seconds 28000.00Kbytes/sec. ftp> cd path201/ex1 250 CWD command successful. ftp> ls 200 PORT command successful. 150 Opening ASCII mode data connection for file list. Monlake.stm 226 Transfer complete. ftp: 13 bytes received in 0.00Seconds 13000.00Kbytes/sec. ftp> binary 200 Type set to I. ftp> get Monlake.stm 200 PORT command successful. 150 Opening BINARY mode data connection for Monlake.stm(146969 bytes). 226 Transfer complete. ftp: 146969 bytes received in 0.01Seconds 9797.93Kbytes/sec. ftp> quit 221 |
![]() |
The command 'pwd' will show you where you are on the server's directory tree.
Downloading files
To download, or 'get', a file from the server, use the get command. For example: get monlake.stm
Note that you may include path information in the command. For example: get /resource/class/fall06/path201/ex1/monlake.stm
The example session in the previous section shows use of the 'get' command to download a file.
Uploading files
To upload a file to the server, use the put command. For example: put ex1imstudent.doc
You may want to upload your files into a new directory. Use the make directory command to create a new directory, and then use the change directory command to move to that directory before uploading your files. For example:
ftp> cd /students/path10/imstudent
ftp> mkdir ex1
ftp> cd ex1
ftp> put ex1imstudent.docNote that your computer expects that the files that you put are in the current directory on your computer. That is, the ftp program will look for files in the directory that you are in when you started the ftp program. On a Windows computer, the command window opens in the Documents and Settings\<user> directory, so you should move the files you want to upload to this directory before starting ftp.
The put command will upload only one file at a time. Use the 'mput' command to upload several files with a single command. For example: mput *.doc
We prefer using a 3rd party program called Filezilla when using SFTP. Click on the link below to learn more about how to connect to our network using Filezilla. You will need to enter you EPRSL login to gain access to the site.
http://wufs.wustl.edu/computers/?filezilla.htm