What is FTP Port Number?

Ports establish connections between a computer and a server. They are the communication links that help us to create accounts, send emails, and exchange files between our devices and the devices of friends, families, and acquaintances.

Regarding file transfers, numerous protocols are available, and transfer is only possible when the right ports are open.

One of the ports that is popular for file transfer is FTP. This article will delve into what an FTP port and port number are, how FTP works, and how to change the default number.

What is FTP Port?

FTP, an acronym for File Transfer Protocol, is the standard protocol or language for transferring files over a TCP/IP network like the internet.

Abhay Bhushan, an MIT student, is the interactive protocol’s author. He created it as a platform for a quick and dependable file transmission method within computers, independent of the machine architecture and operating system.

FTP allows users to copy web pages and graphics containing vast amounts of data and transmit them to web servers. That’s why it’s the ideal choice for web designers and developers.

Anyone can make their files available by simply placing them in a dedicated FTP server, allowing other devices to access the file through the FTP. 

A user can also make his device an FTP server. In windows, a device can be a server using the Internet Information Services Manager.

Ways to transfer files using FTP are by either an internet browser or an FTP client.

If you want to use an internet browser, access a web address. The web address differs from the usual HTTP/HTTPS format. The prefix is “ftp.” So, if someone intends to use a web browser, say Mozilla Firefox, the user must enter the FTP address in the format; ftp.example.com. The address would take you to the desired location and allow you to retrieve files, e.g., a PDF file. 

You may require a passworded account to access the files or access the files anonymously. It all depends on the authentication settings specified for the server. 

Accessing an FTP client provides a better user interface than a generic web browser. All you need is the FTP address, username, password (if available), and port number. A popular and free FTP client is FileZilla.

When the user has access to the server, his local files will display on a box while the server files will open up in another box in the FTP client.

What is FTP Port number?

The default FTP Port number is 21. Port 21 is generally used to make standard, non-encrypted FTP connections. For users of FTP clients, port 21 is a must-know. You can use more ports, but it is based on the type of FTP in consideration.

The two standard FTP ports are ports 20 and 21 since the Internet Assigned Number Authority, IANA, officially assigned both numbers to FTP. Port 21 is the “controlled port,” while port 20 is the “data port.”

Features of FTP port

FTP is not restricted to only file transfers. There are other features of FTP.

Representation of Data

This protocol supports data representations like ASCII, EBCDIC & 8-binary data.

File Organization & Data Structures

This protocol supports both structured and unstructured files.

  • A file of the structured type has a list of records, each of which is denoted by End of Record. As a result, the record structure of such files is its data structure.
  • Unstructured file types include images, audio, videos, and other formats that don’t fall under the structured data format.

Transmission Modes

FTP transfers files into three modes: stream, block, and compressed Mode.

  • The default mode is referred to as stream mode. The file is sent as a steady stream of bytes to TCP in this manner. TCP is therefore responsible for segmenting data into appropriate size chunks.
  • In block mode, data is transferred from FTP across TCP in blocks, each with a three-byte header. The first byte is the block descriptor, and the second and third bytes are just used to specify the block size in bytes.
  • If the sent file is large, it is often compressed in compressed Mode.

Error Control

As TCP is utilized for data transfer, no different error recovery device is necessary.

Access Control

FTP controls file access through the login procedure by entering login details.

Active vs. Passive Modes

Active Mode

Active Mode works in 2 steps

Step 1: A user connects to the server’s FTP port 21 using a file transfer client connected to an arbitrary port. The sent PORT instruction specifies the client-side port to which the server should connect. This port is distinct from the port used in this step for the command channel and will be used later for the data channel.

Step 2: Port 20 on the server establishes a connection with the client port assigned to the data channel. After establishing the data connection, these client and server ports are used for file transfers.

Passive FTP Mode

Step 1: The user connects from an arbitrary port on an FTP client to port 21 on the server through the PASV command. The server responds with information about the random port open for data transfer.

Step 2: The client connects from another arbitrary port to the random port specified by the server. Once a connection is made, data transfer can begin between the client and the server.

Changing the default FTP Port Number

FTP (File Transfer Protocol) transfers files over the internet. By default, FTP uses port 21 to connect the client and the server. However, changing the default port to a different one is possible for various reasons, such as security concerns.

To change the default FTP port number, you need to follow these steps:

  1. Connect your server through an SSH connection using a program like PuTTY.
  2. Use the administrative or root credentials on your server to get in.
  3. Use a text editor to access the “/etc/vsftpd.conf” FTP configuration file.
  4. Locate the line that reads “listen port=21” or anything similar, and replace the “21” with the FTP port number you want to use.
  5. Save the configuration file alterations you made.
  6. Use the command “sudo service vsftpd restart” or “sudo systemctl restart vsftpd.service” to restart the FTP service.
  7. When you finish these procedures, the FTP service will start listening on the new port you designated. It’s crucial to remember that you must also set up your FTP client so that it connects to the server using the new port number.

Conclusion

FTP is a protocol specialized for data transfer. If you work with transferring large data over the network or, say, someone who works with WordPress, FTP is ideal for such users. 

One of the weaknesses of the FTP port is that it is not protected. Therefore, it should be used for sending only insensitive files online.

If you have sensitive data you need to transfer, SFTP (Secure File Transfer Protocol) and TFTP (Trivial File Transfer Protocol) are better alternatives to FTP. You can also try changing the default port number, as that would make it harder for malicious hackers to intercept your data.

Changing the default FTP port is a simple process that involves modifying the FTP configuration file and restarting the FTP service. The new port number you choose should be unique and not in use by any other services to avoid conflicts.

Related Post

SNMP Master Agent Setup on CentOS 7.4 and Ubu

The Simple Network Management Protocol (SNMP) serves as...

Exploring the Ping Command in Linux

The ping command is a powerful network diagnostic tool ...

Setting Up OpenVPN, L2TP/IPSec & SSTP VPN

In today's interconnected world, having a secure and pr...

Fix HTTP Error 505 Version not Supported

In the ever-changing world of the internet, running int...

How to Bypass Internet Restrictions and Censo

In a world where the internet is vital for communicatio...

How to Install PPTP VPN Server on Your VPS

In the modern digital world, where our online activitie...

Leave a Comment