ftp_presentation.ppt

Preview:

Citation preview

File Transfer Protocol

War College

Hellenic Air Force

FTP (file transfer protocol)• Πως χρησιμοποιείται ;• Μπορούμε να χρησιμοποιήσουμε την υπηρεσία ftp για τις εξής περιπτώσεις:• Μεταφορά αρχείων από έναν κεντρικό υπολογιστή στον οποίον ο χρήστης

έχει δικαίωμα πρόσβασης (account), σε έναν άλλον κεντρικό υπολογιστή στον οποίον ο χρήστης επίσης έχει δικαίωμα πρόσβασης.

• Μεταφορά αρχείων από έναν κεντρικό υπολογιστή στον οποίον ο χρήστης έχει δικαίωμα πρόσβασης (account), στον σκληρό δίσκο του προσωπικού του υπολογιστή ή σε δισκέτα και το αντίστροφο.

• Χρήση του ανώνυμου ftp (anomynous ftp), υπηρεσία που χρησιμοποιείται για τη μεταφορά αρχείων από συγκεκριμένους κεντρικούς υπολογιστές, οι οποίοι επιτρέπουν για το σκοπό αυτό την δημόσια προσπέλαση. Ο χρήστης δεν πρέπει απαραίτητα να έχει προσωπικό λογαριασμό για να συνδεθεί με έναν anonymous ftp server, αλλά έχει τη δυνατότητα πρόσβασης χρησιμοποιώντας για όνομα σύνδεσης το anonymous και για password συνήθως την ηλεκτρονική διεύθυνσή του (e-mail).

Overview• File Transfer Protocol

• FTP’s connections• FTP commands• FTP in action• Data Representation• Limitations and future of FTP

• Trivial File Transfer Protocol•FTP and TFTP compared

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

Important RFCs• RFC854: The Telnet Specification

- Used (Minimally) by FTP to send commands• RFC959: The File Transport Protocol

- Basic FTP definition• RFC1350: The TFTP Protocol (Rev. 2)

- “Trivial” file transfer, a subset of FTP• RFC2228: FTP Security Extensions

- Extends RFC959 to include• Authentication, confidentiality, FT encodings

• RFC2577: FTP Security Considerations- An overview of FTP vulnerabilities

The FTP Model

Server PIServer PI

FileFileSystemSystem

User InterfaceUser Interface

User PIUser PI

UserUser

User DTPUser DTPServer DTPServer DTP FileFileSystemSystem

DataData

ControlControl

PI: Protocol InterpreterPI: Protocol InterpreterDTP: Data Transfer ProtocolDTP: Data Transfer Protocol

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.

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

Standard Connection Model

ControlControl

DataDataAA BB

Alternative Connection ModelControlControl

DataData

AA

BB CC

ControlControl

FTP’s Connections

UserInterface

User Data Transfer

Function

UserProtocol

Interpreter

ServerProtocol

Interpreter

Server Data Transfer

Function

client

server

ControlConnection

DataConnection

* Insulates users from “raw” FTP commandsServer is listening on port 21for connection requests

* Routes “raw” FTP commands * Receives server’s replies

* Persistent command and reply connection

Non-persistent data connection

21

20

*Server uses port 20for data connections

FTP’s Connections

UserInterface

User Data Transfer

Function

UserProtocol

Interpreter

ServerProtocol

Interpreter

Server Data Transfer

Function

client

server

ControlConnection

DataConnection

2

ftp> ren.eecis.udel.eduConnected to ren220 ren FTP server ready.Name (ren:umakanth):

USER fisherman

ServerProtocol

Interpreter

UserProtocol

Interpreter

331 Password req for fisherman.Password:

PASS *********

230 User fisherman logged in.ftp> ls myProg.c

Bind toPort 58311

PORT 192,168,0,2,227,199200 PORT command successful.LIST myProg.c

Connect to client PORT

Server Data Transfer

Function

User Data Transfer

Function

150 Opening ASCII mode data connection for /bin/ls.

TerminateConnectionUser

Data Transfer Function

226 Transfer complete-rwxr-xr-x fisherman myProg.c

Server Data Transfer

Function

FTP Client Commands

Command Descriptionget 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 / remotehelp

A-PDU FTP Commands

Command DescriptionABOR Abort previous FTP command and

any data transferLIST [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)

FTP Response format

Reply Description1yz

2yz3yz

4yz5yz

Positive preliminary reply.The action is being started but expect another reply before sending another cmd.Positive completion reply. A new cmd can be sent.Positive intermediate reply. The cmd has been accepted but another cmd must be sent.Transient 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.

x0zx1zx2z

x3z

x4zx5z

Syntax errorsInformationConnections. Replies referring to the control or data connections.Authentication and accounting UnspecifiedFilesystem status

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

Data Representation

• File Type• ASCII file

• Default format for transferring text files. Encoding done using NVT ASCII.

• Nonprint and TELNET• EBCDIC file

• File is transferred using EBCDIC encoding• Image file

• Default format for transferring binary files• Local file

• Data is transferred in logical bytes

Data Representation (cont.)

• Structure• File Structure

• Default : stream of bytes

• Record Structure• Divided into records : only text files

• Page Structure• Divided into pages : each page has a page number and a page header

Transmission Modes• Stream Mode

- Default mode• Block Mode

- Data is delivered to TCP in blocks• Compressed Mode

- Compression using Run-Length Encoding (RLE)

Limitations of FTP

• No file tree transfer

• Limited file management

Trivial FTP (TFTP)• Used only to read and write files

from/to a remote server– Cannot list directories

• Useful for bootstrapping diskless systems– Workstations– X terminals

• Simple and small:– 5 message formats– Runs on UDP– Designed to fit in ROM– Uses a “stop and wait” protocol– NO BUILT IN SECURITY FEATURES (login)

FTP vs. TFTP• FTP provides (minimal) security through

login procedure• TFTP has NO login procedure• FTP Provides a reliable service through

its use of TCP• TFTP must handle it’s own

retransmissions since it uses UDP• FTP uses two connections• TFTP uses one connection (stop and wait)• FTP provides many commands• TFTP provides only 5 commands

Ftp

•File Transfer Protocol (FTP)•Used to copy files between computers on the internet

•Local/Remote

•Ascii/Binary transfers

•Examples

Ftp

•Overview

Topics

•Ascii/Binary transfers

•Examples

Local

Ftp

•Overview

Topics

•Ascii/Binary transfers

•Examples

Remote

Ftp

•Binary transfer is used when an exact copy is required.

–Word documents, executables …

•Ascii transfer is used for text based files.

–notepad, emails …

•Overview

Topics

•Examples

•Local/Remote

Internet Explorer

Internet Explorer

•Type in ftp://username@address•Hit return

Internet Explorer

•You should be prompted for your password

Internet Explorer

Command Line

Command Line

Command Line

Command Line

Changes transfer mode to binary

Command Line

Changes transfer mode to ascii

Command Line

•Transfers a file from your local machine to the connected machine:

- put file

Command Line

•Changes to a new directory on your local machine

- lcd ..

Command Line

•Changes to a new directory on the remote machine

Command Line

•Typing help and then the topic will give you a brief description about the command

File Transfer Protocol (FTP)with Microsoft Internet Explorer

• Start IE. Now, start an FTP Session by typing the address of the FTP site into the address bar of IE:– ftp://isat.project.cisat.jmu.edu

• You will be presented with the following dialog box.

FTP with Microsoft IEType in the User Name: isatType in the Password: Your screen should look something like the one below

IE-FTP (Continued)

• Hit Enter and you will be presented with:

FTP Operations with IE• Double click on the 242 folder and then double click on your section folder.• The file operations you may perform are identical to file operations using

windows explorer. – You may use the menu on the menu bar or right mouse click (the most common

operations are easily accessible via right-mouse-clicks).– Drag-and-Drop operations also work the same as they do in windows explorer.

• Now– Create a new folder using your e-mail user name– Open up windows explorer and drag a file from your disk to the folder you just

created. The file will be copied from your disk to the FTP Site– After confirming it has been transferred, delete it from the FTP Site.– You now have completed the basic operation of FTP using Internet Explorer!

• Close Internet Explorer and you are automatically logged off of the FTP Server

FTP using the WS_FTP Utility

File Transfer Protocol (FTP)• Start an FTP Session• Fill in the Session Profile with your info• Profile Name:

– At Home: • ISAT 242

– In the Lab:• isat.project.cisat.jmu.edu

• Host Name:– isat.project.cisat.jmu.edu

• Host Type • Automatic detect

• User ID• isat

• Password• Leave it blank

FTP - Login

• YOU WILL BE PROMTED TO ENTER A PASSWORD.

• If all went well, you are logged into the server and taken to the Opening Screen shown on the right!

• Carefully examine the screen.

FTP - Screen Description• The left half of the main window is the

local information. The right half of the main window is the remote information. In each half of the main window there are two list boxes. The upper box is a list of directories while the lower half is a list of files. Just to the right of the two listboxes are a column of buttons. These are (from top to bottom):

– ChgDir– MkDir– RmDir– File Mask– View– Exec– Rename– Delete

• Below the listboxes, there are two status lines. You can double click in this area to expand this listing.

FTP - Managing Files• MkDir Button• This is used to create a directory if

possible. You are prompted for a directory name and must supply a name that is valid for the current system. Not all systems allow you to make and delete directories remotely so a failure here does not indicate a failure in this program.

• Rename Button• Used to rename a file if possible. Enter

the new name for the item and press Rename or press Cancel to leave the item intact.

• Delete Button• Used to delete a file if possible. Press

YES to delete the item or NO to cancel. Not all systems allow you to delete files remotely so a failure here does not indicate a failure in this program.

FTP - Remote Directory Creation• Make sure the window for the

remote server is active by clicking anywhere in the right window directory area

• Click the MkDir button• When prompted, enter your

user name for the directory name

• Click OK• You should see the directory

you created listed in the tree structure on the remote system

• Files for this course will be stored in your user directory.

• Now you are ready to transfer files to your directory!

FTP - Transferring Files• Below the listboxes, there are two status

lines. You can double click in this area to expand this listing.

• Click the file that you want to select and press the desired transfer direction button: ( --- > from local computer to server) ( < -- from server to local computer)

• Transferring Multiple Files• To transfer multiple files,

use the CTRL keys when selecting filenames. (this is a standard windows method).

• 1. Click the first file that you want to select.

• 2 Press and hold down CTRL while you click each file.

• To cancel a selection• Press and hold down

CTRL while you click the selected file.• After selecting the desired files, press the

desired transfer direction button.

FTP - Closing the Connection

• After you have transferred your files, close the connection by clicking the close button at the bottom-left corner of the screen

• Click the Exit button on the bottom-right corner of the screen to exit the FTP program

• NOTE: You are NOT permitted to give the password to anyone!

• Login sessions usually are monitored. You should NOT access any folder/files except your own or public ones !

QUESTIONS???