Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 INFO 321 Server Technologies II FTP Material adapted from Dr. Randy Kaplan.

Similar presentations


Presentation on theme: "1 INFO 321 Server Technologies II FTP Material adapted from Dr. Randy Kaplan."— Presentation transcript:

1 1 INFO 321 Server Technologies II FTP Material adapted from Dr. Randy Kaplan

2 2 FTP ◊FTP = File Transfer Protocol ◊What is it? A classic client-server application Purpose: move data from computer A to computer B and vice versa

3 3 FTP ◊What is it? A client server application A pair of programs Allows two computers to communicate to transfer information A well defined protocol

4 4 How It Works? ◊The FTP server is started on a system and waits for incoming requests ◊The user FTP program is started and the user initiates a transfer ◊The local FTP program interprets the command and translates the command into the required form for the server ◊The command is sent to the server

5 5 How It Works? ◊When the command is received by the FTP server it is decoded and acted upon ◊The result is returned to the user FTP program over the data link

6 6 FTP FTP Commands FTP Replies Data Connection Server FTP User FTP

7 7 FTP FTP Commands FTP Replies Data Connection Server FTP User FTP The server protocol interpreter "listens" on Port L for a connection from a user- PI and establishes a control communication connection. It receives standard FTP commands from the user-PI, sends replies, and governs the server-DTP.

8 8 FTP FTP Commands FTP Replies Data Connection Server FTP User FTP The data transfer process, in its normal "active" state, establishes the data connection with the "listening" data port. It sets up parameters for transfer and storage, and transfers data on command from its PI. The DTP can be placed in a "passive" state to listen for, rather than initiate a connection on the data port.

9 9 FTP FTP Commands FTP Replies Data Connection Server FTP User FTP The data transfer process "listens" on the data port for a connection from a server- FTP process. If two servers are transferring data between them, the user-DTP is inactive.

10 10 FTP FTP Commands FTP Replies Data Connection Server FTP User FTP The user protocol interpreter initiates the control connection from its port U to the server-FTP process, initiates FTP commands, and governs the user-DTP if that process is part of the file transfer.

11 11 Launching FTP, version 1 ◊In order to use FTP, you need to know the name of a host that has an FTP server running ◊Start from a terminal window or command prompt ◊To initiate an FTP session and go to a specific server use ftp followed by the hostname C:\ ftp host.site.tld

12 12 Launching FTP, version 1 ◊After you enter this command, you will be asked for a user name and password ◊For anonymous login, try User name is ‘anonymous’ Password is ‘password’ ◊After you log in successfully, an FTP prompt will be displayed ftp>

13 Launching FTP, version 2 ◊Or you can start FTP without a hostname C:\> ftp ◊When you do this, the FTP prompt is displayed ftp>

14 14 Launching FTP, version 2 ◊Then connect to an FTP server using the open command ftp> open ftp-server-name For example, ftp> open ftp.sei.cmu.edu ◊Log in to the server as shown on slide 12

15 FTP help! ◊The local help information can be obtained within FTP using the command ? or help ftp> ? ftp> help ftp> help commandname ◊Help for the remote FTP server can be found with remotehelp ftp> remotehelp

16 16 Exiting FTP ◊To log out from the current FTP server, use the disconnect or close commands ftp> disconnect ftp> close ◊To exit FTP completely, enter the command quit or bye ftp> quit ftp> bye

17 17 Transfer modes ◊When transferring a file there are two modes in which a file transfer can occur ◊ASCII Transfer files in text mode (text or PDF files) ◊BINARY Transfer files in binary mode (as a sequence of binary digits) Used for transferring executables and compressed files

18 18 Transfer modes ◊The command to set which data transfer mode is in use is ‘type’ ftp> type ascii ftp> type binary ◊Or those types are also standalone commands ftp> ascii ftp> binary

19 19 Transferring Files ◊In order to send one file from your computer to the FTP server (upload) use the command put or send ftp> put filename ftp> send filename

20 Transferring Files ◊In order to transfer one file from the FTP server to your computer (download) use the command get or recv ftp> get filename ftp> recv filename

21 21 Multiple file transfers ◊Transferring multiple files Sometimes you may wish to transfer a group of files You can accomplish this with the mget command (download) or the mput command (upload)

22 22 Multiple file transfers ◊For example, if you enter the command ftp> mget foo* ◊Then all of the files whose name begin with foo will be downloaded ◊Likewise to upload a group of files, use the command mput ftp> mput bar* ◊All of the files whose name begins with bar will be uploaded to the server

23 23 Navigating in FTP ◊When you use these commands (get, put) they assume that the activity will take place in the current directory on the FTP server ◊To see what files are in the current FTP server (remote) directory you can use the command dir or ls ftp> dir ftp> ls

24 24 Navigating in FTP ◊You can change the directory on the remote FTP server by using the command cd ftp> cd directoryname ◊You can change the directory on your local computer while in the FTP client by using the command lcd ftp> lcd directoryname

25 Navigating in FTP ◊You can show the current remote directory with the pwd command ftp> pwd ◊Remote directories can be created or deleted (if you have permission) with mkdir or rmdir, respectively ftp> mkdir foldername ftp> rmdir foldername

26 26 Shell commands ◊Bang (!) is used to execute a command directly by the shell (outside of FTP) ◊For example, if you enter !cd downdir ◊The cd command will be executed by the shell This particular result will be the same as using lcd – just to show the use of bang

27 27 FTP Server Protocol ◊In order to implement the FTP protocol, the server understands a set of commands issued by the FTP client See http://ftpguide.com/index.htmhttp://ftpguide.com/index.htm

28 28 FTP Protocol ◊Client-Server Commands ◊Access Control Commands USER – accept user name PASS – accept password ACCT – set account information, usually tied to USER CWD – change working directory CDUP – change to parent directory SMNT – mount a different file system REIN – reinitialize; terminate the session QUIT – also terminates a session

29 29 Access Control Commands ◊USER The USER commands identifies the user to the server This information is required to gain access to the FTP server and the files that can be transferred

30 30 Access Control Commands ◊PASS The PASS command will always follow the USER command It specifies a password to enable a user to gain access to the FTP server

31 31 Access Control Commands ◊QUIT This command terminates a session for a user If there is no transfer then the server will close the control connection If there is a transfer in progress, the connection will remain open until a result

32 32 FTP Protocol ◊Client-Server Commands ◊Transfer Parameter Commands PORT – specify data port to be used PASV – requests server to listen on a given port TYPE – same as the previous type command STRU – specifies the file structure code MODE – set send/receive mode

33 33 Transfer Parameter Commands ◊TYPE The TYPE command is used to specify the type of data that will be transferred during a file transfer task The codes used in the command that specify the data type are as follows –  A = ASCII  E = EBCDIC  I = IMAGE (Binary transfer)  L = BYTE

34 34 Transfer Parameter Commands ◊MODE The modes that are used to transfer data are  Stream  Block  Compressed

35 35 FTP Protocol ◊Client-Server Commands ◊FTP Service Commands RETR – transfer a file STOR – accept incoming data STOU – accept unique file APPE – append existing file ALLO – allocate space REST – set restart point RNFR – rename from RNTO – rename to ABOR – abort previous cmd DELE – delete file RMD – remove directory MKD – make directory PWD – print working dir. LIST – transfer a list of files NLST – transfer list of file names SITE – set server services SYST – identify server OS STAT – send status HELP – send command list NOOP – a server ping

36 36 FTP Service Commands ◊RETR (Retrieve) This command causes the server to transfer a file to the computer at the other end of the connection

37 37 FTP Service Commands ◊STOR (Store) Causes a file to be transferred from the computer at the other end of the connection and store on the server If the file exists it is overwritten If the file does not exist, it is created

38 38 FTP Service Commands ◊APPE (Append) This command causes the server to append data transferred from the computer at the other end of the connection to be appended to the named file on the server If the file exists, data is appended If the file does not exists, the file is create

39 39 FTP Service Commands ◊RNFR (Rename from) This is one of a pair of commands used to rename a file This command specifies the file that is to be renamed The command is immediately followed by a RNTO command (Rename to)

40 40 FTP Service Commands ◊RNTO (Rename to) The second of the rename commands Specifies the new name of the file ◊ABOR (Abort) This command tells the server to stop whatever it was doing; this includes aborting the last command and any data transfer associated with that command

41 41 FTP Service Commands ◊DELE (Delete file) This command causes the named file to be deleted from the server site ◊RMD (Remove Directory) This command causes the specified directory to be removed from the server The path can be absolute or relative

42 42 FTP Service Commands ◊MKD (Make directory) This command creates the specified directory on the server ◊PWD (Print working directory) Causes the current directory name to be returned as the result (on the server)

43 43 FTP Service Commands ◊LIST (List) If the pathname specifies a directory then the files in the directory are transferred If the pathname specifies a group of files then the files specified are transferred If the pathname names a file then information about the file is sent

44 44 FTP Service Commands ◊STAT (Status) Causes a status response to be send If no argument is specified then the server returns general information about the status of the server If the command is sent during a file transfer, the server will respond with the status of the transfer

45 45 FTP Service Commands ◊HELP Causes the server to send helpful information about the implementation over the connection

46 46 FTP Protocol ◊FTP Replies The purpose of replies from the server to the client is for the client to understand the precise status of the server after a request was made An FTP reply consists of –  A 3 digit code  Some text  Here are some examples Here

47 47 Installing FTP (Server) ◊Most OS that make FTP available, come with the FTP server installed ◊For example, one of the package options during the Linux installation is FTP ◊On Windows, the FTP server can be loaded as an optional piece of IIS software and then started

48 48 Installing FTP (Windows) The FTP server is part of the IIS option in the Windows Components dialog. This dialog is accessible through the control panel and Add/Remove Programs.

49 Installing FTP (Windows 2003)

50 50 Windows FTP Services ◊In order to check to see if your FTP services are running, in the Control Panel double click on Internet Information Services

51 51 Windows FTP Services ◊A control panel will be displayed

52 52 Windows FTP Services Click on FTP Sites Make sure the status of the site is running

53 53 Example FTP into your own FTP server

54 54 Example Log in anonymously

55 55 Example Identify local and remote directories

56 56 Example

57 57 Example

58 58 Example ◊Why did this problem occur? On the server side, permissions were not set so that the anonymous log on could have access to the directory to store the file ◊How do you fix it?

59 59 Example

60 60 Try to open this file … ◊Why?

61 61 Example

62 62 On the server side … ◊Try to open the file again …

63 FTP Summary ◊So to use FTP effectively, need to know Host FTP server Login information (if not anonymous) File location(s), both remotely and locally File types (binary or ascii)


Download ppt "1 INFO 321 Server Technologies II FTP Material adapted from Dr. Randy Kaplan."

Similar presentations


Ads by Google