+ All Categories
Home > Documents > Ftp.75 to 76

Ftp.75 to 76

Date post: 05-Dec-2014
Category:
Upload: myrajendra
View: 794 times
Download: 2 times
Share this document with a friend
Description:
 
29
ftp protocol with video 1 Sub Topic : Introduction to File Transfer Protocol (FTP) .
Transcript
Page 1: Ftp.75 to 76

ftp protocol with video 1

Sub Topic : Introduction to File Transfer Protocol (FTP)

.

Page 2: Ftp.75 to 76

2

Recap

In the previous class, you have learnt about

• Post Office Protocol• Installation and configuration of POP3 connector• POP and commands and process• Limitations of POP• Internet Mail Access Protocol (IMAP)• Comparison of POP and IMAP

Page 3: Ftp.75 to 76

3

Objectives

On completion of this class, you would be able to understand about

• FTP’s connections

• FTP commands and responses

• FTP in action

• FTP Connections

• Transfer Modes

Page 4: Ftp.75 to 76

4

Recap of Mail Protocols

• SMTP: delivery/storage to receiver’s mail server

• Mail access protocols: retrieval from server– POP: Post Office Protocol [RFC 1939]

• authorization and download – IMAP: Internet Mail Access Protocol [RFC 1730]

• manipulation of stored messages on server– HTTP: Hotmail , Yahoo! Mail, etc

useragent

sender’s mail server

useragent

SMTP SMTP POP3 orIMAP

receiver’s mail server

BHARATHI SANTOSH

Fig .1

Page 5: Ftp.75 to 76

5

File Transfer Protocol (FTP)

• A general-purpose protocol that can be used to copy an arbitrary file from one computer to another

• one of the oldest network application---predates TCP and IP

• Later versions were built on top of TCP/IP

• Among the most heavily used applications– FTP generated as much as 1/3 of the traffic on the

Internet– Was exceeded only by WWW (in 1995)

Page 6: Ftp.75 to 76

6

File Transfer Protocol

• Provides reliable transfer of files

• Between different hosts running on different platforms MS Windows, Apple Mac,

Sun, BSD UNIX, SCO UNIX, Linux

• Using different file structures

• Supports ASCII and binary content

Fig .2

Page 7: Ftp.75 to 76

7

FTP Standards

• RFC 959

• uses two TCP Ports – one for control– one for data transfers

• command-response protocol

• control port uses telnet protocol to negotiate session– US-ASCII– <crlf> is end-of-line character

Page 8: Ftp.75 to 76

8

Control and Data Connections

• Control functions (commands) and reply codes are transferred over the control connection

• All data transfer takes place over the data connection

• The control connection must be “up” while data transfer takes place

Page 9: Ftp.75 to 76

9

Control Connection

• The control connection is the “well known” service

• The control connection uses the TELNET protocol

• Commands and replies are all line oriented text (default is ASCII)

Page 10: Ftp.75 to 76

10

Standard Connection Model

ControlControl

DataDataAAAA BBBB

Fig .3

Page 11: Ftp.75 to 76

11

Alternative Connection Model

ControlControl

DataData

AA

BBBB CCCC

ControlControl

Fig .4

Page 12: Ftp.75 to 76

12

Transfer Modes

• FTP defines two types of transfer – textual and binary

• Textual: is used for text files– most text files are encoded in ASCII or EBCDIC– ftp can translate from the local to remote character

set when transferring a file• Binary: used for all other files (audio, image, numbers,

…)– Files are copied exactly– The resulting copy might be meaningless because

FTP does not convert values to the local representation

Page 13: Ftp.75 to 76

13

FTP: File Transfer Protocol

• transfer file to/from remote host• client/server model

– client: side that initiates transfer (either to/from remote)– server: remote host, serves the file

• ftp: RFC 959• ftp server: port 21 (well known)

file transfer FTPserver

FTPuser

interface

FTPclient

local filesystem

remote filesystem

user at

hostFig .5

Page 14: Ftp.75 to 76

14

Separate Control & Data Connections

• ftp client contacts server at port 21, specifying TCP as the transport protocol

• Parallel TCP connections– control: exchange commands,

responses between client and server

– data: file data to/from server

• ftp server maintains “state”– current directory– earlier authentication

FTPclient

FTPserver

TCP control connection

port 21

TCP data connection

port 20

Fig .6

Page 15: Ftp.75 to 76

15

FTP Client Commands

Command Description

get filename Retrieve file from server

mget filename* Retrieve multiple files from server

put filename Copy local file to server

mput filename* Copy multiple local files to server

open server Begin login to server

bye / close / exit Logoff server

ls / dir List files in current remote dir on server

lcd Change local directory

cd Change remote directory

rhelp / remotehelpTable 1

Page 16: Ftp.75 to 76

16

FTP Commands

Command Description

Abor Abort previous FTP command and any data transfer

List [filelist ] List files or directories (ls / dir)

Pass password Password on server

Port n1,n2,n3,n4,n5,n6 Client IP and port number

Retr filename Retrieve (get) filename

Stor filename Store (put) filename

Noop Do nothing (check if server is alive)

Table 2

Page 17: Ftp.75 to 76

17

FTP Response Format

Reply Description1yz

2yz3yz

4yz

5yz

Positive preliminary reply.The action is being started but expect another reply before sending another cmdPositive completion reply. A new cmd can be sent

Positive intermediate reply. The cmd has been accepted but another cmd must be sentTransient negative completion reply. The requested action did not take place but can be sent laterPermanent negative completion reply. Cmd not accepted and should not be reissued

x0zx1z

x2z

x3z

x4zx5z

Syntax errors

InformationConnections. Replies referring to the control or data connectionsAuthentication and accounting

UnspecifiedFilesystem status Table 3

Page 18: Ftp.75 to 76

18

Example FTP Responses

• 120 Service will be ready shortly

• 200 Command OK

• 230 User login OK

• 331 User name OK; password is needed

• 421 Service not available

• 503 Bad sequence of commands

• 530 User not logged in

Page 19: Ftp.75 to 76

19

Connections, Authorizations and File permissions

• The remote system has to verify that the user is authorized to access files– The user has to provide a login name and a password– If the user is authorized he/she may start transferring

files• What if the user does not have an account?

– System administrator can configure FTP to support anonymous FTP

– Login name anonymous and password guest (or e-mail address) allows a user access to public files

Page 20: Ftp.75 to 76

20

FTP uses the client-server paradigm

– Local application (or browser) is the client

– Remote FTP program is the server

– The FTP server authorizes the connection, locates the file, and uses TCP to send it

Fig .8

Page 21: Ftp.75 to 76

21

Active 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)

ClientServer20 21 1026 1027

1

2

3

4

Page 22: Ftp.75 to 76

22

Passive 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

ClientServer20 21 1026 1027

1

2

2024

3

4

Page 23: Ftp.75 to 76

23

Transmission Modes

• Mode is used to specify additional coding or sequencing performed on data

• independent of data type and file structure– Stream S stream of bytes, if record

structure EOF sent as record indication; if file eof indicated by

closing stream– Block B file sent as sequence of blocks

preceded by header info allows restart of an interruped transfer

– Compressed C data compressed using run length encoding

Page 24: Ftp.75 to 76

24

Transfer Files in a Heterogeneous Host Environment

• 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

size• Client responsibility to tell server data type to use• Default data type, unless otherwise specified is ASCII

Page 25: Ftp.75 to 76

25

File Structures

• Operating System store files in different structures• FTP 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

Page 26: Ftp.75 to 76

26

A Browser can use FTP

• A W W W browser can be used for FTP instead of a dedicated interface

• A browser uses FTP as the transfer protocol, when the URL starts with ftp (instead of http)

• Example– ftp://ftp.acunix.albany.edu/as7656/temp --- instructs

the browser to get file “as7656/temp” from machine ftp.acunix.edu

– ftp://ftp.acunix.edu/as7656 --- displays all files in the directory “as7656”

Page 27: Ftp.75 to 76

27

Summary

In this class, you have learnt about

• File Transfer Protocol

• Commands & Responses

• FTP Transfer Modes

• Transaction Phase

• Transmission Modes

Page 28: Ftp.75 to 76

28

Quiz

1) FTP uses 2 TCP ports : one for data transfer and the other for____

A) Control

2) Control connection uses ___ protocolA) Telnet

3) The FTP command used to retrieve a file from the remote computer is ___A) Get

4) The remote system verifies ____ and ___ to authorize user to access filesA) login Name (or user id) and Password

Page 29: Ftp.75 to 76

Home ftp protocol with video

29

Frequently Asked Questions

1. Explain file transfer protocol (FTP)


Recommended