|
CogSci 3 |
Introduction to Computing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Using FTPWhat is FTP?For this course, the term FTP will be used to mean 3 different, but related concepts.
Copying Files over the InternetIn this course, we will sometimes use the notion of "FTP" to mean copying files back and forth over the Internet, as opposed to file serving. The actual software application used might be the command line oriented FTP program, or more than likely, one of the graphic front ends to the FTP protocol, like Fetch or WS-FTP. We may say: "you can FTP your files" to mean that you can copy your files over the network using an "FTP like" program.You could also use one of the secure/SSH based versions like SCP (Secure Copy Program) or SFTP (Secure FTP), or their graphic front ends. These all use encryption for the login process (when you enter your username and password on the server) as well as for the data transfer to keep your information private. You should prefer to use a secure version of FTP if you can; we are going to refer to both secure and unsecure versions as just FTP. FTP requires an Internet network connection. In order to use FTP from home, you must have an ISP (for DSL or cable modem), or use the PPP (Point to Point Protocol) software with a dial up service provider (like campus Network Operations or AOL, Earthlink, etc). You can use an Internet browser like Internet Explorer or Netscape Navigator to download files from an anonymous FTP server on the Internet to your computer using FTP. Just use the ftp:// URL scheme along with the address of the FTPserver as the URL. The browser will take care of logging you in as user "anonymous". For instance, in the figure at the right, we have accessed files on ntserve.ucsd.edu using the URL: ftp://ntserve.ucsd.edu (using the Macintosh version of Internet Explorer ). However, to upload files (like your homework) from your home computer to the class server, you must have an FTP program. (You will also need to have an account on the computer you wish to upload to.) Not only will FTP let you turn in your homework from home, but you can also upload (or download) large files (like software programs) that are too big to fit on a floppy disk.
It's also worth mentioning that while you can send files back
and forth via email, many mail servers have limits on the
size of a single message.
If the data you are sending is binary in nature (like an
image, or word processing document), it has to be encoded
as ASCII in order to pass through the mail system.
This encoding will make the document even larger than it is
in its binary format! This is not the transparent operation that one has using file server disks, such as Appleshare or a network drive, where the remote computer's disk is mounted on your computer, and appears (and acts) just like a local hard disk. On a Macintosh, the file server's disk icon appears on the desktop, while in Windows, the icon appears in "My Computer" (icon usually found on the upper left hand of the desktop; or in the Start menu of Windows XP). With a file server, you are able to double click on the file server icon to open and browse it's contents. You can open (double click) and modify the original copy of a document on the file server. Or using the SaveAs dialog, you are able to navigate directly to the file server disk and save there. With FTP on the other hand, you must
The Network ProtocolThe File Transport Protocol or FTP is an old method of accessing a remote computer's disks over a network. It allows you to copy files between the remote computer's disk and the disk(s) on the local computer. Note: the remote computer and local computer can be the same machine; you could use that fact to copy files to or from a friend's account on icogsci1.FTP is a client/server protocol. In order to access files on a computer via FTP, that computer must be running an FTP server. The FTP ProgramThe original FTP is a command line oriented program. That is, the user types in commands to copy files, create directories, get a directory listing, navigate the file system on the remote computer, etc.
Despite its somewhat crufty command line user interface
Using the FTP ProgramCommand line oriented versions of FTP usually take the name of the remote system that you want to connect to as an argument. Thus, to connect to host icogsci1 (.ucsd.edu), on a UNIX system, you would type:ftp icogsci1.ucsd.eduat the UNIX prompt. In Windows, you can use the Run command in the Start menu (Start->Run), or open a MSDOS window (in the Programs Menu--in Windows 2000 and XP it is called: Start->(All)Programs->Accessories->Command Prompt), and then type FTP and the host name you want to connect to (like above). You can also simply type: ftp. Then use the open command within FTP to specify the remote connection. E.g., open icogsci1.ucsd.edu On a Macintosh with NCSA Telnet, you use the File->Open dialog to specify the host name, and then click the "Ftp Session" box; this will create an out going FTP connection to the host. Note that both NCSA Telnet and Better Telnet allow you to do a somewhat peculiar thing, namely to FTP into your Macintosh. In this scenario, you use Telnet to log into the host (e.g., icogsci1), and then FTP back to your Macintosh. (You may have to set the preferences for the Telnet software to allow for incoming connections). Now the "remote" computer is your Macintosh, and the "local" computer is the host you telnet-ed to. Local vs RemoteThere are a couple of things that make using the command line version of FTP difficult. One is that it is a command line program; you type commands to navigate through the folders and transfer files.Another thing that makes FTP hard is that there are two computers involved. When you use a file server, there are also 2 computers involved, but you are not really aware of the file server as a computer, since it appears to be a local disk. With FTP, on the other hand, you need to be aware of the both computers: the local one, which has the screen and keyboard you are using. And the remote computer, which is the one you want to upload to, or download from--the one you "FTP to". Logging InIn order to use FTP, you need to have a computer account on the remote system. Immediately after the connection to the remote computer is completed, you will be prompted for your account name on the remote computer and then a password.Anonymous FTP ServersSome special servers, called anonymous FTP servers, let people access a set of public files. With an anonymous server, you open a connection in the normal way, but then log in with the username of anonymous (or sometimes guest or ftp). Instead of your password, give your email address.For transferring files to or from your class accounts, you will, of course, log in with the appropriate class account and corresponding password. Some FTP servers, for instance the one built into NCSA Telnet for the Macintosh, do not automatically prompt for the user (account) name after the connection is made. You will have to use the user command within FTP to start the process. If you make a mistake logging in, say, by mistyping your password, you can restart the log in process by using the user command. The FTP CommandsYou can get a list of the many possible FTP commands by typing a "?" or "help" at the ftp> prompt.ftp> ? Commands may be abbreviated. Commands are: ! cr macdef proxy send $ delete mdelete sendport status account debug mdir put struct append dir mget pwd sunique ascii disconnect mkdir quit tenex bell form mls quote trace binary get mode recv type bye glob mput remotehelp user case hash nmap rename verbose cd help ntrans reset ? cdup lcd open rmdir close ls prompt runique ftp> Typically, you only use a very small subset of these, for instance, for navigation. Navigating the Remote File SystemOnce you have connected and logged in to the remote computer, you will probably need to "move" around both the remote computer's file system to locate the files or directories (same idea as folders you want to work with. FTP uses UNIX-like commands for navigation:
lcdcd foo is the command to change into directory foo (which is in your current directory) on the remote system. You may also need to change folders on the local system/drive as well. The lcd command (local cd) is used for that.Navigating through your folders on your PC with lcd can be difficult:
It might be easier to use the "Command Prompt" window to navigate to the folder where you will get your data to or put your data from. And then start FTP afterwards. That way, you shouldn't need to lcd. By the way, if you start FTP via Start->Run in one of the ACS Windows XP labs, it appears as if the initial local directory is your My Documents folder. Copying Files -- getYou send a file from the local computer to the current directory on the remote computer. You recv a file from the remote computer.There are put and get synonyms for send and recv, respectively. For example: get foowill copy a file called foo from the current directory on the remote computer. The copy will be called foo on the local computer. You can also rename the file during the copy process. get foo barwill copy foo from the remote computer and call the copy bar on the local computer. putIf you want to go the other way, from the local computer to the remote computer, use put instead of get. To put a file called index.html into a directory called public_html, you would use the following ftp commands:cd public_html put index.html Multiple FilesThe file copy commands (e.g., get and put) handle a single file at a time. There are special versions: mget and mput, that copy multiple files at a time. Depending on what type of remote server software is running, you may be able to specify multiple files using wild card notation.For instance, mget *.htmlwill copy all the files that end in .html. By default, mget and mput will ask you about each file name before doing the actual copy/transfer. You may find it convenient to use the prompt command before starting the mput or mget to turn off prompting during the copy process. The prompt command is a toggle; use the command once to turn off prompting, use it again to turn prompting back on; like flipping a light switch. Directory/Folder HierarchiesFTP does not do a good job of transferring whole hierarchies. Yes, mget and mput will let you copy every file in a directory (and create names for subdirectories), but you must copy the contents of each subdirectory separately by hand.For large directory structures, it may make sense to "bundle up" the folders and files before FTP-ing, perhaps using the zip program. Then FTP the single bundle and then undo (unzip) it after the copy. UNIX users often use the tar command to create such a bundle, and then use tar again at the remote end to undbundle. The secure version of FTP called: SCP, usually takes a -r recursive flag argument. The -r copies a directory hierarchy! Binary or ASCIIText files should be copied in ASCII mode. ASCII is a 7 bit code describing the English alphabet, digits, punchation, and 32 control characters (like line feed, back space, etc). That is, only 7 of the 8 bits in a byte are used. This is the default transfer mode for FTP.Some forms of FTP client software (for instance, on the Macintosh and under DOS or Windows) do special processing of the end of line character in text files. That is, the end of line character for text is a line feed (0xa in hexadecimal) on UNIX systems, but a carriage return (0xd in hex) on the Macintosh. Windows or DOS programs want both a carriage return and line feed at the end of each line. In ASCII mode, FTP will translate the end of line convention on the sending system to that required on the receiving end. All other files should be transfered in binary mode. If you don't know what sort of file you have, use binary mode. All 8 bits are transfered in binary more. There is no translation of any sort. There is an FTP "binary" command to change to binary mode (just bin will do).
In particular, all graphic images, program files,
tar archives, zip files, and
even word processing documents (.doc)
should be transfered in binary mode.
Copying such a file/document in ASCII mode will corrupt it
(badly), so that it can't be used.
A GUI Front EndMuch of the command line nature of the original FTP can be masked by a graphical front end. Fetch for the Macintosh and WS-FTP for Windows are such GUIs. Both Fetch and WS-FTP have an initial log in dialog that asks for the remote computer/host name, your login name and password and the directory to start in on the remote host. You can save the information you type in as a "profile" or "short cut".Once you have logged into the remote computer, you are presented with a somewhat graphical view of the files in the current directory (on the remote computer); something like view that Windows Explorer (not Internet Explorer).
Copying a file can be as easy as double clicking on it.
Here is the Fetch open (log in) dialog.
And here is the display of the remote file system.
Fetch and Macintosh Special NoteThe Macintosh file system structure is very different from most other (UNIX, Windows, DOS) file systems. That means a couple of things:
Fetch tries to figure out the format to put files in. Sometimes this automatic determination is incorrect, so you should plan to override it manually. Part of the put dialog allows the user to specify the exact format. For images and sounds, "raw binary" is the right choice, probably for Word (or other word processing documents) too.
Here is the initial, "log on" window.
And here is the display once you have logged into the remote system.
The WS-FTP dialog is similar to Fetch's except there are 2 sets of files listed. The files and folders on the left are on the local disk; those on the right are on the remote system. Generally, the names of all the folders are displayed before the file names, however, you can alter that behavior (select the Options button). As in UNIX, .. is a shortcut for the parent/upper folder. Click on the .. entry to move up one folder level, just like in the Windows Save and Open dialogs. As usual with Windows, you need to be careful about the 8.3 type filenames. To copy a file, from the system and folder on the left (the local system) to the folder on the right, simply select the file (or folder) in the left window and then click the -> button. WS_FTP will copy a whole folder hierarchy too--much more convenient than the command line FTP. Getting WS_FTPIf you have a Windows computer at home, and would like to use WS_FTP, you first need to get a copy of the application. If you bought the dialin connection software from Network Operations, then you probably already have the software. Otherwise, you maybe able to get a copy via Google (or elsewhere on the Internet).You can download the ws_ftple.exe installer file from the Windows_NT->ftp folder (on ntserve). Be sure to remember the folder that you specified in the SaveAs dialog. Once it has copied down, then you can open that folder, and double click on ws_ftple to get it installed. Or use the command line oriented FTP. First, Start->Programs->MSdos to open a dos window. Then in that window type:
FTP Summary
Terms to Know
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||