Upload
lordmwesh
View
2.708
Download
10
Tags:
Embed Size (px)
DESCRIPTION
How to upload and download files using an FTP client. All about the File Transfer Protocol
Citation preview
File Transfer ProtocolFile Transfer Protocolin in “Client Server “Client Server Computing” Computing”
BY
Mwendwa [email protected]
16 Feb 2011
atCatholic University of Eastern
AfricaMain Campus, Nairobi, Kenya)
CONTENTSCONTENTS
IntroductionDesired OutcomesWhat is FTP?Modes of TransferBasic StepsBasic CommandsTransfer using GUI toolsWays to Connect to FTP ServersSummaryTerminology
INTRODUCTIONINTRODUCTION
The objectives of this FTP session are: 1) to demonstrate sharing of files, 2) to transfer data reliably and
efficiently,3) to explain different file viewing
software. 4) familiarize with terminology relating
to FTP5) help navigate in ftp directories6) Know the Basics of ftp
DESIRED OUTCOMESDESIRED OUTCOMES Use the FTP program. Recognize different types of file extensions. E.g.:
-.txt, .avi, .jpg. Know how to login as “anonymous” in FTP programs Know the difference between ASCII files and Binary
files. Know how to end an FTP session. Use basic FTP commands. Define FTP. Know that FTP is “case sensitive”. Connect to other FTP addresses and navigate in them. Know you will need to have an “Anti-virus” program
on your machine (**software on the net may have a virus).
WHAT IS FTP?WHAT IS FTP?FTP (RFC 959) works on the client/server
principle. A client program enables the user to interact with a server in order to access information and services on the server computer.
Files that can be transferred are stored on computers called FTP servers. To access these files, an FTP client program is used. This is an interface that allows the user to locate the file(s) to be transferred and initiate the transfer process.
FTP uses two TCP Ports ◦ one for control (port 21)◦ one for data transfers (port 20)
Goals of FTPGoals of FTPSharing of filesIndirect use of remote computersHandle different file systemsTransfer data reliably and
efficiently
MODE OF TRANSFERMODE OF TRANSFER
There are two modes of transfer in FTP: ascii and binary.
ASCII is used only for files saved in ASCII format (this includes Postcript files)
Binary is used for files that are formatted and saved using a wordprocessing software like WordPerfect (.txt), spreadsheets (.xls), images (.jpg, .gif), and many executable programs (.exe) and videos (.avi).
FTP clients select the transfer mode automatically.
Active Mode FTPActive Mode FTP Client connect from a random unprivileged port (n >
1023) to the servers command port (21) and sends port command to tell server to connect to n+1 then listens on the next higher unprivileged port (n+1) for server responses. The server connects from it’s data port (20) to the client data port (n+1)
ClientServer
20 21 1026 1027
1
2
3
4
Passive Mode FTPPassive Mode FTP Client opens two random unprivileged ports ( n >
1023 and n+1; ex 1026 and 1027) and connects the first port (n) to server command port 21 and issues a pasv command (server sends port to use for data); client connects to servers specified data port, server completes connection.
ClientServer
20 21 1026 1027
1
2
2024
3
4
Transfer Files in a Transfer Files in a Heterogeneous Host Heterogeneous Host EnvironmentEnvironment
Due to multiple hardware types and operating systems file are converted to four environmentally neutral data type for transport and the converted to local types at the destination◦ ASCII A NVT-ASCII◦ EBCDIC E EBCDIC Text◦ IMAGE I Raw binary, series of octets◦ LOCAL L Raw binary using a variable
byte sizeClient responsibility to tell server data type
to useDefault data type, unless otherwise
specified is ASCII
File StructuresFile StructuresOperating System store files in
different structuresFTP defined file structures for
transporting files◦ File F Unstructured, sequence of bytes◦ Record R Series of records◦ Page P Series of data blocks (pages)
Default file structure is File (F)File Structure specified using STRU
command
BASIC STEPS TO USE FTPBASIC STEPS TO USE FTP
Connect to the FTP serverNavigate the file structure to find
the file you wantTransfer the fileThe specifics of each step will
vary, depending on the client program being used and the type of Internet connection.
FTPFTP ModelModel
User User Interface
User PI
User DTP
Server PI
Server DTP
Local file system
Remote file system
Data Connection
Control connection
PI = Protocol InterpreterDTP = Data Transfer ProcessUser FTP
Server FTP
BASIC FTP BASIC FTP COMMANDSCOMMANDS
• FTP - initiate ftp session• open <host> - connect to an ftp server• binary - specify files to up/download; are
more than flat text (up files, images, programs, etc.)
• get <filename> - download a file from the server
• put <filename> - upload a file to the server
• close - close connection to the server• quit/exit - end the ftp session• user - re-enter login name
FTPFTP CommandsCommands• pwd - display present working directory
on server• lpwd - display the local present working
directory (on connecting machine)• cd - change directory• dir or ls - directory listing of
files/directories on Server• lcd - change directory on Local Machine• lcd~ - home shortcut• mget *.* - multiple file downloads• mput *.* - multiple file uploads• cdup - to move backwards to the previous
directory
Login using MSDOSLogin using MSDOS
Typical FTP RESPONSE Typical FTP RESPONSE Scenario Scenario
(Connect to FTP server)
220 Service Ready
USER username
331 User ok, password required
PASS password
230 User Logged in
RETR test.txt
150 Opening data connection
(Server makes data connection to local host)
226 Transfer complete
User FTP Server FTP
Copy file from serverCopy file from server Click on Start>Run >type CMD>Enter FTP Open kenya.or.ke Your login name Your password ftp>lcd c:\filename (this is the file you want
to download into. Specify location of local directory)
ftp> binary ftp>hash (you want it “on”) just type hash at
the prompt if its “off” ftp>dir c* - (yes, use an asterix) ftp>get <filename> The file is now in your local directory
USING GUI TOOLS for USING GUI TOOLS for FTPFTPFTP clients can be interactive
command-line based, or Graphical User Interface (GUI) clients for different operating systems.
Popular FREE and Open Source FTP GUI tools are Filezilla, cuteFTP and WinSCP.
Using WinSCPUsing WinSCPDownload winscp from
www.winscp.netOpen the winscp.exe programAdd your server detailsHostname: kenya.or.keUsername: anonymousPassword:Port Number: 21Protocol: FTPAfter Login, you get a File Manager
showing the Client computer, and the Server Computer
TRANSFER FILES USING TRANSFER FILES USING GUI (WinSCP)GUI (WinSCP)
WinSCP loginWinSCP login
Transfer of files using Transfer of files using WinSCPWinSCP
Select the source file and the destination location
Drag the source file to the destination folder
To delete a file, right click on it then click delete
To change permissions on a file, right click on the file, then select Properties. On the permission section, tick or untick Owner, Group or Other e.g. 777 means all permissions
Copying from client to Copying from client to serverserver
After CopyAfter Copy
Other Operations on Other Operations on WinSCPWinSCPCreate directoryList Directory ContentsDelete filesChange permissionsCompress and uncompress filesTransfer filesCopy and move files
CONNECT TO OTHER FTP CONNECT TO OTHER FTP SERVERSSERVERS
At your ftp> prompt simply type in their address. e.g. : ftp>cuea.edu
In Firefox, type the ftp address in the top box. e.g. : ftp://cuea.com
Login as “anonymous”, but be sure to give your complete e-mail address as the password.
Once you are at their ftp> prompt type “dir”. This will bring up their list of files for you to select from.
When you have chosen a file, at the ftp> prompt type - “cd pub” (or whatever) then type “dir” again.
Choose the particular file you want to download. Set transfer mode to binary. Make sure “hash” is “on”. ftp> get (filename) This will engage the transfer to your computer.
COMPRESSED FILESCOMPRESSED FILES
Sometimes you may come across files on FTP that are compressed.
Compression decreases the file size and enables more files to be stored on the server, and also makes file transfer times shorter.
To be able to use a compressed file it needs to be decompressed using compatible software.
Remember to keep an up-to-date version of virus checking software on your computer before you transfer files to it.
You can recognize a compressed file by its extension. Eg. .z, .gz, .sit, .zip.
Transfer these files in Binary Mode. Once they are on your machine you need special
software to decompress them. This software are often found free on the net..
Closing FTP SessionsClosing FTP Sessions
To Logout of an FTP program you must type EXIT at the ftp> prompt. When you type CLOSE it doesn’t exit out of the FTP program.
When done browsing files in a remote server type: ftp>close, you will still have ftp> on your screen since you didn’t “exit” the program. You can either type “exit” or the word “open” and another FTP address.
SUMMARYSUMMARY FTP (File Transfer Protocol) enables files to be
transferred from one computer to another. An FTP client program is an interface that allows the
user to locate file(s) to be transferred and initiate the process.
Through anonymous FTP, users have access to many different types of files including shareware, freeware, upgrades and documents.
You can transfer and view files that may aid you in writing proposals, or sending and receiving information to book vendors, and also can be used to electronically send a large document to another user without having to print it out and deliver them a hard copy.
Using FTP is a fun and sometimes challenging adventure. As new technology and equipment become more commonplace in our work environments, the means by which we learn and teach must evolve and change just as rapidly as the technology.
FTP TERMINOLOGYFTP TERMINOLOGY ASCII - American Standard Code for Information
Interchange) -- Standard for the code numbers used by computers to represent all the upper and lower-case Latin letters, numbers, punctuation, tec. There are 128 standard ASCII codes each of which can be represented by a 7 digit binary number: 0000000 through 1111111.
BINARY - Used for files that are formatted and saved using a wordprocessing software like WordPerfect, spreadsheets, images, and many executable programs.
BROWSER - A program which allows a person to read hypertext. The browser gives some means of viewing the contents of nodes, and of navigating from one node to another.
FTP - (File Transfer Protocol)-a client program that enables the user to send files from one computer to another via the telephone network with the aid of the internet.
LOCAL PC - your desktop computer that you will transfer files to.
HOST - Any computer on a network that is a repository for services available to other computers on the network..
LOGIN - The account name used to gain access to a computer system, or the act of entering into a computer system.
FTP TERMINOLOGYFTP TERMINOLOGY(CONT.)(CONT.)
NODE - Any single computer connected to a network. PROTOCOLS - sets of communication rules that allow clients and
servers to communicate accurately with each other. SERVER - A computer, or a software package, that provides a
specific kind of service to client software running on other computers.
INTERNET - The vast collection of inter-connected networks that all use the TCP/IP protocols and that evolved from the ARPANET of the late 60’s and 70’s.
TCP/IP - Transmission Control Protocl/Internet Protocol -- /tus us te syute if oriticiks that defines the Internet. To be truly on the Internet, your computer must have TCP/IP software.
ANONYMOUS FTP - Allows a user to retrieve documents, files, programs, and other archived data from anywhere in the Internet without having to establish a userid and password. By using the special userid of “anonymous” the network user will bypass local security checks and will have access to publicly accessible files on the remote system.
ARCHIVE SITE - A machine that provides access to a collection of files across the Internet.
USER ID - On most host systems, the first time you connect you are asked to supply a one-word user name. This can be any combination of letters and numbers. This is usally also your e-mail name.
FTP TERMINOLOGYFTP TERMINOLOGY(CONT.)(CONT.)
VIRUS PROGRAMS -viruses are small, invasive programs that are designed to create havoc within your computer systems. There is software to protect your computer from viruses. If you plan to swap disks with others, the first software program you should install should be a virus protection program.
TELNET - The command and program used to login from one Internet site to another. The telnet command/program gets you to the “login” prompt of another host.
CLIENT - A software program that is used to contact and obtain data from a Server software program on another computer, often across a great distance. Each Client program is designed to work with one or more specific kinds of Server programs, and each Server requires a specific kind of Client.
VIRUS - A program which replicates itself on computer systems by incorporating itself into other programs which are shared among computer systems.
FTP TIPSFTP TIPS
When retrieving non-text files, you must use Binary Mode, otherwise the file(s) get messed up.
FTP is case sensitive) Be aware that software files on the net may
have a virus.
ENDEND