lecture 7 -_ftp,_tftp,_telnet_and_ssh

48
1 Lecture 7: File Transfer and Remote File Access BITS 2513 INTERNET TECHNOLOGY

Upload: serioussamsoul

Post on 18-Dec-2014

1.224 views

Category:

Education


0 download

DESCRIPTION

Chapter 7 Internet Technology

TRANSCRIPT

Page 1: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

1

Lecture 7: File Transfer and Remote File AccessBITS 2513 INTERNET TECHNOLOGY

Page 2: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

2

Using FTP to Transfer Files Web servers (using HTTP) and e-mail software

(using SMTP) must encode data so it appears as text when it travels over the Internet.

FTP (File Transfer Protocol) offers an alternative.

An FTP site is a computer running an FTP server application.

On FTP server a program called daemon allows to download and upload files

Page 3: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

3

Using FTP to Transfer Files (cont.)

FTP can transfer binary files over the Internet without the encoding and decoding overhead, making it a popular protocol for moving files over the Internet.

FTP also use to upload files from your computer to another computer on the internet

Page 4: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

4

Using FTP to Transfer Files (cont.) Large organizations might maintain several FTP sites in

different parts of the world to speed up download time across the globe.

These are called mirror sites. A mirror site is a server that contains the same set of

files as a heavily used server to off-load some of the burden of providing the files to the community using them.

Mirror sites also serve as a backup for the main server in case the main server fails.

Page 5: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

5

How FTP Works

An FTP server identifies users on an FTP site by their user IDs.

FTP client and server software create a session after you are logged on.

The FTP client has access to the file system on the server.

The local computer (the client) issues character-like commands, and the remote computer (the server) replies with numbers that are interpreted by the local computer.

Page 6: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

6

How FTP Works (cont.) FTP client and server software can access their

individual file system and transfer files in either direction

FileSystem

FTPClient FTP

ServerFile

System

Local host Remote host

Page 7: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

7

How FTP Works (cont.)

FTP server usually listen at port 21 for client activity

Most Web servers have FTP service running to receive changes to Web pages files from web developers

FTP server normally run on the same computer that is running a Web server

Page 8: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

8

Requirements for using FTP

An FTP client installed on the computer. Login details of the FTP server to which you want to

connect: The FTP server address. This looks a lot like the address you

type in Internet Explorer to browse websites. One such example is “ftp://ftmk.kutkm.edu.my”.

The user name and password required for the FTP connection. Some FTP servers let you connect to them anonymously. For anonymous connections, you do not need a user name and password.

Page 9: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

9

FTP Via a Web Browser Have you ever attempted to download software

from a Web site and clicked a hyperlink that says “Click here to download now” or a similar message?

If you carefully note the URL after you click to download the software, you will see that the protocol changes from http:// to ftp:// in the Web browser’s Address box.

Page 10: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

10

How to use FTP Logging on to an FTP site with a Web browser

Page 11: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

11

How to use FTP When you log on to an FTP site, you can browse through the

available files by changing directories, seeing listing of all files and etc.

Using Windows Explorer to access FTP site

Page 12: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

12

How to use FTP An error occur when you attempt to upload a file to an

FTP site where you don’t have write permission

Page 13: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

13

FTP from a Command Prompt

Most operating systems, including Windows 9x, Windows NT, Windows 2000, and Windows XP, offer FTP client software that runs from a command prompt.

A batch file is a file with a .bat file extension that contains a list of DOS-like commands that can be executed as a group.

Page 14: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

14

FTP from a Command Prompt cont.) Another protocol similar to FTP is TFTP (Trivial

FTP).

TFTP has fewer commands than FTP and can be used only to send and receive files.

It can be used for multicasting in which a file is sent to more than one client at the same time using the UDP (User Datagram Protocol).

Page 15: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

15

FTP session using Windows XP FTP utility

Page 16: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

16

FTP CommandsOpening and closing connection ftp - starts an FTP session open hostname - connects to the specified host close - closes the connection (but not the FTP session!) quit - terminates the FTP session

Browsing on a remote machine dir - gives a full directory listing on the remote machine dir test* - displays only files and directories whose name begins with

"test..." ls - same as dir, but provides a simplified listing of filenames

Directories in FTP pwd - prints the name of the current remote directory cd remote-directory - changes working directory on remote host cd .. - moves up one level in the directory structure on the remote host lcd directory - changes the default directory on local host

Page 17: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

Trivial File Transfer Protocol:TFTP Usage and Design Transfer files between processes. Minimal overhead (no security). Designed for UDP, although could be used with

many transport protocols. Easy to implement Small - possible to include in firmware Used to bootstrap workstations and network

devices.

17

Page 18: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

18

Diskless Workstation Booting 1The call for help

DisklessWorkstation

Help! I don't know who I am!My Ethernet address is:4C:23:17:77:A6:03

RARP

Page 19: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

19

DisklessWorkstation

I know all! You are to be know as: 128.113.45.211

RARP REPLY

RARPServer

The answer from the all-knowing

Page 20: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

20

DisklessWorkstation

I need the file namedboot-128.113.45.211

TFTP Request (Broadcast)

The request for instructions

Page 21: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

21

The dialog

DisklessWorkstation

TFTP File Transfer

TFTPServer

here is part 1

I got part 1

here is part 2

boot file

Page 22: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

22

TFTP Protocol

5 message types: Read requestWrite request Data ACK (acknowledgment) Error

Page 23: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

23

Messages

Each is an independent UDP Datagram

Each has a 2 byte opcode (1st 2 bytes)

The structure of the rest of the datagram depends on the opcode.

Page 24: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

24

FILENAME

Message FormatsOPCODE 0 0MODE

BLOCK# DATA

BLOCK#

OPCODE

OPCODE

OPCODE BLOCK# ERROR MESSAGE 0

2 bytes 2 bytes

Page 25: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

25

01 filename 0 mode 0

2 byte opcodenetwork byte order

null terminated ascii stringcontaining name of file

null terminated ascii stringcontaining transfer mode

variable length fields!

Read Request

Page 26: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

26

Write Request

02 filename 0 mode 0

2 byte opcodenetwork byte order

null terminated ascii stringcontaining name of file

null terminated ascii stringcontaining transfer mode

variable length fields!

Page 27: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

27

TFTP Data Packet

03 block # data 0 to 512 bytes

2 byte opcodenetwork byte order

2 byte block numbernetwork byte order

all data packets have 512 bytesexcept the last one.

Page 28: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

28

TFTP Acknowledgment

04 block #

2 byte opcodenetwork byte order

2 byte block numbernetwork byte order

Page 29: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

29

TFTP Error Packet

05 errcode errstring

2 byte opcodenetwork byte order

2 byte error codenetwork byte order

null terminated ascii error string

0

Page 30: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

30

TFTP transfer modes

“netascii” : for transferring text files. all lines end with \r\n (CR,LF). provides standard format for transferring text files. both ends responsible for converting to/from

netascii format. “octet” : for transferring binary files.

no translation done.

Page 31: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

31

NetAscii Transfer ModeUnix - end of line marker is just '\n'

receiving a file you need to remove '\r' before storing data.

sending a file you need to replace every '\n' with "\r\n" before

sending

Page 32: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

32

TELNET

Page 33: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

33

Initiating and Using Telnet Sessions

Telnet enable user to;

create a remote command console session on a host.

run command line programs, shell commands, and scripts in a remote command console session just as though you were locally logged on to the host and using a local command prompt window.

Page 34: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

34

Telnet

Telnet is a protocol used to pass commands and replies between the client the UNIX computer.

All UNIX systems support some form of Telnet.

Windows versions also include Telnet Client and Telnet Server components.

Page 35: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

35

How Telnet Works

To use Telnet you need to know IP address of the host where the resource you want to use

When you contact the host, the distant computer and your computer negotiate how to communicate with each other

When client and server communicate they use Telnet protocol

Page 36: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

36

How Telnet Works

You can start the service manually every time you want to connect to a host,

Or you can configure the service so that it starts every time your computer starts.

Telnet clients cannot connect to a host unless a Telnet server program (or service) is running and listening for connection requests.

Page 37: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

37

How Telnet Works

When run a Telnet client, it makes a connection request to the host (Telnet server).

If a Telnet server responds to the request, the Telnet client and server negotiate the details of the connection, such as flow control settings, window size, and terminal type.

After the connection details are successfully negotiated, and logon credentials are validated, the Telnet server program creates a Telnet command console session.

Page 38: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

38

Telnet in Windows XP

Use Run dialog box, type telnet mydomain.com

Use web browser Enter telnet://mydomain.com in the address box

Page 39: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

39

Telnet in DOS prompt

Page 40: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

40

Telnet in HyperTerminal

Page 41: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

41

Examples of TELNET client/server

Tlntsvr.exe (Telnet Server) - preinstalled in Windows OS

Telnet.exe (Telnet Server) – preinstalled in Windows OS

Page 42: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

42

Telnet Commands

open - to open hostname port number to establish a Telnet connection to a host.

close - to close an existing Telnet connection quit - to exit from Telnet status - to determine whether the Telnet client is

connected.

Page 43: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

43

Telnet Limitations

Telnet is a character-based communication protocol and not designed to transmit cursor movements or GUI information.

Can only run command line programs, shell commands, scripts, and batch files

Some editing programs, such as vi and Edit, can be run over a Telnet connection

However, these interactive programs are not true GUI programs because cursor movement is controlled by the keyboard, not the mouse.

Page 44: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

44

Telnet Limitations (cont.)

By default, Telnet does not encrypt any data sent over the connection (including passwords), and so it is trivial to eavesdrop on the communications and use the password later for malicious purposes.

Lacks an authentication scheme that makes it possible to ensure that communication is carried out between the two desired hosts

Page 45: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

45

Using Secure Shell (SSH) Protocol

SSH enables two computer to negotiate and establish secure connection that use encryption

May stop cracker who try to sniff password and data

Provide secure communication for doing email, accessing Web, login to remote site and publishing file in FTP (SFTP)

Page 46: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

46

Using SSH Protocol (cont.)

It uses public-key cryptography to authenticate the remote computer and to allow the remote computer to authenticate the user

SSH provides confidentiality and integrity of data exchanged between the two computers using encryption message authentication codes (MACs).

PuTTY is a free SSH client and multiplatform - establish a secure channel between a local and a remote computer

Page 47: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

47

Summary

FTP sites can be accessed by client software, such as Web browsers, operating system command utilities, or GUI software dedicated to FTP, such as WS_FTP Pro.

FTP also can be accessed from a command prompt.

Page 48: Lecture 7 -_ftp,_tftp,_telnet_and_ssh

48

Summary (cont.)

Telnet program runs on the computer and connects PC to a server on the network.

Enter commands through the Telnet program and they will be executed as if you were entering them directly on the server console.

Enables you to control the server and communicate with other servers on the network