FTP File Transfer Protocol Graeme Strachan
Agenda An Overview A Demonstration An Activity
History Created to allow transfer of data between servers - was published as an RFC in 1973 Became available for clients to access/upload/download files 1 st wave of the internet It was the backbone of all file transactions on the internet Had a number of major revisions E.g. the change from NCP to TCP/IP HTTP has now passed it in volume of transactions Still widely used – faster than HTTP
FTP Overview FTP (File Transfer Protocol) is used to transfer data from one computer to another over the Internet, or through a network. Client and Server Uses TCP only. (no UDP) Uses two ports, 'data' - port 20 the data port is not always on port 20 'command' - port 21 (also known as the control port)
Active session Step 1, Client's command port contacts the server's command port and sends the command PORT Step 2 - Server then sends an ACK back to the client's command port. Step 3 - Server initiates a connection on its local data port to the data port the client specified earlier. Step 4 - client sends an ACK to the client's data port. ACK = Acknowledgement
Client side. The FTP client doesn't make the actual connection to the data port of the server. It simply tells the server what port it is listening on. The server connects back to the specified port on the client. From the client side firewall this appears to be an outside system initiating a connection to an internal client--something that is usually blocked. Active session - Problem
Passive Session Step 1 - Client contacts the server on the command port and issues the PASV command. Step 2 - Server replies with PORT 2024, telling the client which port it is listening to for the data connection. Step 3 - Client then initiates the data connection from its data port to the specified server data port. Step 4 - Server sends back an ACK to the client's data port.
Passive Session - considerations Passive mode FTP solves many client side problems. Server side - needs to allow any remote connection to high numbered ports on the server. Some FTP daemons allow the administrator to specify a range of ports which the FTP server will use. Some clients do not support passive mode. (eg Solaris command line FTP utility). Increased usage of web browsers as an FTP client. Most browsers only support passive mode when accessing ftp:// URLs. This can either be good or bad depending on what the servers and firewalls are configured to support.
TCP Protocol Map ( ) FTP runs exclusively over TCP. TCP
Criticisms of FTP Passwords and file contents are sent in clear text Packet Sniffers Multiple TCP/IP connections are used. Firewall software needs additional logic to account for these. Hard to filter in active mode on the client side as the client must open a random port. Largely resolved by using passive mode FTP. It is possible to abuse the protocol by telling a server to send data to a port of a third computer. FTP is a high latency due to the number of commands needed to initiate a transfer. No integrity check on the receiver side. integrity checks have to be managed externally. No error detection. Relies on TCP layer for error control (comparatively weak checksum by modern standards). No date/timestamp attribute transfer. Uploaded files are given a new current timestamp (SFTP does).
Variations TFTP Trivial File Transfer Protocol Very simple Minimal memory Useful for: booting computers and routers which did not have any data storage. Transfer of small files between hosts on a network. Remote X Window terminal or other thin client boots from a network host or server. TFTP has been used by viruses/worms, (e.g. Blaster), as a way to spread and infect new hosts.
Variations SSH – Secure Shell Uses public-key cryptography for authentication. Typically used to log into a remote machine and execute commands Supports tunnelling Secure FTP - FTP over SSH Don’t confuse with SSL/TLS – FTPS (SSL -Secure Sockets Layer) SFTP - SSH File Transfer Protocol A common misconception is that SFTP is simply FTP run over SSH Uses SSH Rebuilt from the ground up Secure Copy Protocol – SCP Uses SSH Older protocol
Demonstrations 2 Servers Anonymous User: test Password: testuser
Command Line
Client commands helphelp - Displays descriptions for ftp commands
Filezilla
Filezilla –
Filezilla – test, testuser