What is an FTP Server?

Whats an FTP Server? - The Protocol File Transfer or FTP is a network protocol for transferring files between networked systems TCP (Transmission Control Protocol), based on the architecture client-server . From a client computer you can connect to a server to download files from it or to send files to it, regardless of the operating system used on each computer.

The FTP service is offered by the application layer of the TCP / IP network layer model to the user, normally using network ports 20 and 21. A basic problem with FTP is that it is designed to offer the maximum speed in the connection , but not the maximum security, since all the exchange of information, from the login and password of the user on the server to the transfer of any file, is done in plain text without any type of encryption, with which a possible attacker can capture this traffic, access the server and / or appropriate the transferred files.

To solve this problem are useful applications such as SCP and SFTP , included in the SSH package , which allow to transfer files but encrypting all traffic.


The FTP protocol was first used in April 1971, published as RFC 114 , before the TCP / IP stack existed. The general structure was established in 1973. It was modified several times, adding new commands and functionalities. In the end, RFC 959 was published in October 1985, which is the one currently used. 1

The FTP Model

In the model, the user protocol (PI) interpreter initiates the control connection on port 21. Standard FTP commands are generated by the user PI and transmitted to the server process through the control connection. The standard responses are sent from the PI of the server to the user PI by the control connection in response to the commands.

These FTP commands specify parameters for the data connection (data port, transfer mode, type of representation and structure) and the nature of the operation on the file system (store, retrieve, add, delete, etc.). The user data transfer process (DTP) or other process must wait for the server to initiate the connection to the specified data port (port 20 in active or standard mode) and transfer the data according to the parameters that have been specified.

We also see in the diagram that the communication between client and server is independent of the file system used in each computer , so it does not matter that their operating systems are different, because the entities that communicate with each other are the PIs and the DTPs, that use the same standardized protocol: FTP.

It should also be noted that the data connection is bidirectional, that is, it can be used simultaneously to send and receive, and it does not have to exist all the time the FTP connection lasts. But it had a problem in the beginning, and it was the location of the servers in the network. That is, the user who wanted to download a file using trump should know what machine was located. The only information search tool that existed was Gopher, with all its limitations.

First information search engine

Gopher means 'throw on' the information. It is a service whose objective is the location of files from its title. It consists of a set of menus of resources located in different machines that are interconnected. Each machine serves an area of ​​information, but its internal organization allows all of them to work as if it were a single machine. The user navigates through these menus to locate the information sought, and does not know exactly what machine is downloading this information. With the arrival of the Internet, the powerful search engines left the Gopher service, and the location of the FTP servers stopped being a problem. Nowadays, when the user downloads a file from a link on a web page, he or she does not even know that he is doing it from an FTP server. The FTP service has evolved over time and today is widely used on the Internet, in corporate networks, Intranets, etc. Supported by any operating system, there is a large amount of software based on the FTP protocol.

FTP server

An FTP server is a special program that runs on a server computer normally connected to the Internet (although it can be connected to other types of networks, LAN , MAN , etc.). Its function is to allow the exchange of data between different servers / computers.

In general, FTP server programs are not usually found on personal computers, so a user will normally use FTP to remotely connect to one and thus exchange information with it.

The most common applications of FTP servers are usually web hosting , in which your clients use the service to upload their web pages and their corresponding files; or as a backup server (backup) of important files that a company may have. For this, there are FTP communication protocols for data to be transmitted encrypted, such as the SFTP ( Secure File Transfer Protocol ).

Serv examples
  • FileZilla
  • Titan FTP Server
  • WS_FTP Server

FTP client

When a browser is not equipped with the FTP function, or if you want to upload files to a remote computer, you will need to use an FTP client program. An FTP client is a program that is installed on the user's computer, and that uses the FTP protocol to connect to an FTP server and transfer files, either to download them or to upload them.

To use an FTP client, you need to know the name of the file, the computer where it resides (server, in the case of downloading files), the computer to which you want to transfer the file (in case you want to upload it to the server) , and the folder in which it is.

Some basic FTP clients in console mode are integrated into operating systems , including Microsoft Windows , DOS , GNU / Linux and Unix . However, there are available clients with added options and graphical interface. Although many browsers have already integrated FTP, it is more reliable when connecting to non-anonymous FTP servers using a client program.

Anonymous access

Anonymous FTP servers offer their services freely to all users, allow access to your files without having a 'USER ID' or a user account. It is the most convenient way out of the web service to allow everyone to have access to certain information without the administrator of a system having to create an account for each user.

If a server has 'anonymous FTP' service just by typing the word 'anonymous', when you ask for your user you will have access to that system. No preset password is needed, although you will have to enter one just for that moment, normally you usually use your own email address.

This is the only way to get access to FTP files, although with fewer privileges than a normal user. Normally you will only be able to read and copy the files that are public, as indicated by the administrator of the server to which we want to connect.

Normally, an anonymous FTP server is used to deposit large files that have no utility if they are not transferred to the user's machine, such as programs, and web page servers (HTTP) are reserved to store textual information for reading online.

User access

If you wish to have access privileges to any part of the file system of the FTP server, to modify existing files, and to be able to upload your own files, it is usually done through a user account. In the server the information of the different user accounts that can access it is saved, so to initiate an FTP session we must introduce an authentication (in English : login ) and a password (in English: password ) that identifies us univocally .

Web-based FTP client

A "Web-based FTP client" is nothing more than an FTP client which can be accessed through our web browser without having to have another application for it. The user connects via HTTP to a web server, and the web server connects via FTP to the file server. The web server acts as an intermediary by passing the information from the FTP server on ports 20 and 21 to the HTTP port 80 that the user sees.

There are always times when we are away from home, we do not carry the laptop and we need to perform some urgent task from a public access computer, a friend, work, university, etc. The most common is that the applications we need are not installed and in many cases we do not even have the necessary permissions to carry out their installation. Other times we are behind a proxy or firewall that does not allow us to access external FTP servers.

By having a Web-based FTP client we can access the remote FTP server as if we were doing any other type of web browsing. Through a Web-based FTP client you can create, copy, rename and delete files and directories. Change permissions, edit, view, upload and download files, as well as any other FTP protocol function that the remote FTP server allows.

Guest access

The unrestricted access to the server provided by the user accounts implies security problems, which has led to a third type of FTP access called guest (guest), which can be seen as a mixture of the previous two.

The idea of ​​this mechanism is the following: it is about allowing each user to connect to the machine by means of their login and password, but avoiding access to parts of the file system that they do not need to perform their work, in this way they will access to a restricted environment, something very similar to what happens in anonymous access, but with more privileges.

Examples of FTP clients

Among the various FTP clients that there may be mentioned the following:
  • net2ftp
  • WebDrive 3
  • Web-Ftp
  • Jambai FTP
  • ftp4net
  • PHP FTP Client
  • Asuk PHP FTP
  • Weeble File Manager
  • FileZilla

FTP client connection modes

FTP supports two client connection modes. These modes are called active (or Standard, or PORT, because the client sends PORT-type commands to the server by the control channel when establishing the connection) and passive (or PASV, because in this case it sends PASV-type commands). In both Active and Passive modes, the client establishes a connection to the server through port 21, which establishes the control channel.

Active mode

In Active mode, the server always creates the data channel on its port 20, while on the client side the data channel is associated with a random port greater than 1024. To do this, the client sends a PORT command to the server by the control channel indicating that port number, so that the server can open a data connection where the files and lists will be transferred, in the specified port.

The previous thing has a serious problem of security, and is that the client machine must be willing to accept any input connection in a port higher than 1024, with the problems that this implies if we have the equipment connected to an insecure network such as the Internet. In fact, firewalls that are installed on the computer to avoid attacks will surely reject those random connections. To solve this, the passive mode was developed .

Passive mode

When the client sends a PASV command on the control channel, the FTP server indicates the port (greater than 1024 of the server, Example: 2040) to which the client must connect. The client initiates a connection from the next port to the control port (Example: 1036) to the server port specified above (Example: 2040). 5

Before each new transfer in both Active and Passive mode, the client must send again a control command (PORT or PASV, depending on the mode in which it is connected), and the server will receive that data connection in a new port (random if it is in passive mode or by port 20 if it is in active mode).

Types of file transfer in FTP

In the FTP protocol there are 2 types of transfer in ASCII and in binaries. It is important to know how to transport a file throughout the network, if we do not use the appropriate options we can destroy the information in the file. Therefore, when executing the FTP application, we must remember to use one of these commands (or put the corresponding option in a program with graphical interface):

ASCII type

Suitable for transferring files that only contain printable characters (ASCII files, not files resulting from a word processor), for example HTML pages, but not the images they may contain. Some control symbols are transformed to keep them compatible between different systems, for example, if the file is hosted on a linux server, the linefeed for the text files is "\ n" (byte 10 in decimal). If the client is a Mac system, the line break is "\ r" (byte 13 in decimal), this mode changes these control symbols so that the file is legible on both sides, just as if it is sent to a system windows, the line break is "\ r \ n" (two bytes, 13 and 10). If this mode is used in files that are not plain text,

Binary Type

This type is used when it comes to compressed files, executables for PC, images, audio files, among others.

Examples of how to transfer some file types depending on their extension:
File extensionType of transfer
txt (text)ascii
html (WEB page)ascii
DOC (document)binary
ps (poscript)ascii
hqx (compressed)ascii
Z (compressed)binary
ZIP (compressed)binary
ZOO (compressed)binary
Sit (compressed)binary
pit (compressed)binary
shar (compressed)binary
uu (compressed)binary
ARC (compressed)binary
tar (packaged)binary
In the network there are several software solutions that develop this type of technology, the best known are Filezilla ( free software ) and CuteFTP ( shareware ).

FTP commands

Command and argumentsAction performed
open serverStart a connection to an FTP server.
close or disconnectEnds an FTP connection without closing the client program.
bye or quitEnds an FTP connection and the working session with the client program.
cd directoryChange the working directory on the server.
delete fileDelete a file on the server
mdelete patternIt erases multiple files based on a pattern that is applied to the name.
dirIt shows the contents of the directory where we are on the server.
get fileGet a file
Noop No OperationThe server is informed that the client is in non-operation mode, the server usually responds with a "ZZZ" and refreshes the user's inactive time counter.
mget filesGet multiple files
hashEnables the printing of characters # as files are transferred, as a progress bar.
lcd directoryChange the local working directory.
lsDisplays the contents of the directory on the server.
promptEnables / disables confirmation by the user of the execution of commands. For example when deleting multiple files.
put fileSend a file to the active directory of the server.
mput filesSend multiple files.
pwdShows the active directory on the server.
rename fileChange the name to a file on the server.
rmdir directoryDelete a directory on the server if that directory is empty.
statusShows the current status of the connection.
bin or binaryActivates the binary transfer mode.
asciiActivates the transfer mode in ASCII text mode.
!It allows to exit to command line temporarily without cutting the connection. To go back, type exit on the command line.
command nameDisplays the information related to the command.
or helpDisplays a list of available commands.
append file nameContinue a download that has been previously cut.
bellEnables / disables the playback of a sound when any file transfer process has finished.
globActivate / deactivate the display of long names of our PC.
literalWith this command you can execute server commands remotely. To know the available is used: literal help .
mkdirCreate the indicated directory remotely.
quoteIt does the same function as literal .
send file nameSend the indicated file to the active directory of the server.
userTo change our username and password without leaving the ftp session.

FTP response codes

Below is a summary of the response of FTP codes that can be returned by an FTP server. These codes have been standardized in RFC 959 by the IETF. The response code is a three-digit value. The first digit is used to indicate one of three possible outcomes-success, failure or to indicate an error or incomplete response:
  • 2yz - answer Success
  • 4yz or 5yz - No answer
  • 1yz or 3yz - An error or incomplete answer
The second digit defines the error class:
  • x0z - Syntax. These responses refer to syntax errors.
  • x1z - Information. The answers to requests for information.
  • x2z - Connections. Answers in reference to control and data connections.
  • x3z - Authentication and accounting. Answers for the login process and accounting procedures.
  • x4z - Not defined.
  • x5z - File system. These responses transmit status codes from the server's file system.
The third digit of the response code is used to provide additional details for each of the categories defined by the second digit.

Connection to a protected FTP server from the browser

To log in to an FTP server that requires a password type the URL in this way:
Where is the username, is the FTP server, is the access password, and is the directory where we start session.
Example: ftp://alumno:alumnopass@ftp.example.com/public