How to Setup FTP Server on Ubuntu 20.04

How to Setup FTP Server on Ubuntu 20.04

5 minutes, 23 seconds Read

In today’s fast-paced digital landscape, the necessity for efficient and secure file transfers remains an absolute priority. Whether you’re responsible for managing critical business documents or simply sharing personal files, the twin pillars of security and reliability are non-negotiable. This is precisely where FTP (File Transfer Protocol) steps onto the stage. For users of Ubuntu 20.04, you’re in for a treat, as this versatile platform offers a robust foundation for establishing your very own FTP server, ensuring the confidentiality and safety of your data during transfers.

In the following comprehensive guide, we will embark on a journey to walk you through the process of creating an FTP server on your Ubuntu 20.04 system. Whether your objective is to secure file sharing with colleagues or create a reliable remote backup system, this meticulously crafted, step-by-step tutorial will equip you with the knowledge and tools needed to accomplish your objectives.

What is FTP?

FTP (File Transfer Protocol) is a foundational and widely used network protocol that facilitates the seamless transfer of files between computers or servers over a network, typically the internet or an intranet. It was initially developed in the early 1970s and has since evolved into a fundamental tool for sharing and managing files across different platforms and systems.

Features of SFTP

1. File Transfer: FTP’s primary function is to transfer files between a client and a server over a network, allowing users to upload, download, and manage files efficiently.

2. Client-Server Model: FTP operates on a client-server architecture, where the client initiates requests and the server responds to those requests. This model enables efficient and organized file transfers.

3. Port-based Communication: FTP uses two ports for communication. Port 21 is used for control commands (e.g., login, list directories), while Port 20 is used for the actual data transfer. This separation enhances security and allows for concurrent data transfers.

4. Authentication Options: FTP supports various authentication methods, including username/password, public key authentication, and SSL/TLS certificates, enabling secure access control to the server.

5. Transfer Modes: FTP offers two primary transfer modes:

* ASCII mode: Suitable for text files, ensuring proper line-ending conversions for different platforms.

* Binary mode: Ideal for non-text files like images and executables, ensuring bit-for-bit accuracy during transfer.

6. Directory Listing: Users can navigate remote directories, list files and directories on the server, and retrieve information about file attributes and permissions.

7. Anonymous FTP: FTP servers can be configured to allow anonymous access, permitting users to connect without providing authentication credentials. This is often used for distributing publicly available data.

Installation Steps

Step 1: Update Your System:

Before installing any new software, it’s always a good idea to update your package list to ensure you have the latest information about available packages:

sudo apt update

Step 2 :Install vsftpd:

There are various FTP server software options available for Linux, but one of the most popular and secure choices is vsftpd (Very Secure FTP Daemon). You can install it using the following command:

sudo apt install vsftpd

To initiate the service and ensure it starts automatically during system boot, execute the following commands:

sudo systemctl start vsftpd

Step 3: Configure vsftpd:

After the successful installation of vsftpd, the next crucial step involves configuring it. The configuration file for vsftpd can be found at the path /etc/vsftpd.conf.

To make modifications to this configuration file, please open a terminal window and utilize the following command:

sudo nano /etc/vsftpd.conf

Within the configuration file, you will encounter various options, but our focus is on specific changes.

Begin by uncommenting the line commencing with “anonymous_enable” – remove the ‘#’ symbol. This step is essential to grant anonymous users access to your FTP server.

how-to-setup-ftp-server-on-ubuntu-20-04-1-cybrosys

To enable local users to access the FTP server, uncomment the lines and add “Yes” to the end:

Uncomment the line that starts with “local_enable”, “write_enable” and add “YES” to enable local users:

how-to-setup-ftp-server-on-ubuntu-20-04-2-cybrosys

Save the changes and exit the editor by pressing Ctrl+X, then Y, and then Enter.

Step 4: Restart vsftpd

To apply the configuration changes made to the file, it’s essential to restart the vsftpd service. To do so, execute the following command:

sudo systemctl restart vsftpd

Step 5: Firewall Configuration

Ubuntu 22.04 is equipped with the Uncomplicated Firewall (ufw) as its default firewall. To ensure the FTP server operates smoothly, it’s essential to permit FTP traffic through the firewall.

You can grant permission for FTP traffic by executing the following command:

sudo ufw allow ftp

Step 6: Create FTP User

To allow users to connect to your FTP server, you need to create FTP user accounts. Here’s how you can create an FTP user and set a password for them:

1. Create the FTP user using the useradd command. Replace “testuser” with the desired username:

sudo useradd -m testuser

2. Set a password for the FTP user. Replace “testuser” with the username you created in the previous step:

sudo passwd testuser

Step 7: Connect to Ubuntu FTP Server

You can establish a connection to your FTP server using the following command:

sudo ftp your-server-name

Replace “your-server-name” with the actual hostname or IP address of your Ubuntu FTP server. This information can be obtained from your system or network configuration.

To determine your hostname, simply open a terminal and enter the following command:

hostname

This command will display your system’s hostname. Once you have the correct server name or IP address, running the initial command will initiate the connection to your FTP server, enabling you to commence file transfers to and from the server.

Here is an example of connecting to ftp using terminal.

how-to-setup-ftp-server-on-ubuntu-20-04-3-cybrosys

Then type in the username and password of the ftp user you have created:

how-to-setup-ftp-server-on-ubuntu-20-04-4-cybrosys

Afterward, you will be successfully connected to the FTP server, ready to begin transferring files.

Conclusion:

In conclusion, you have now successfully configured and established an FTP (File Transfer Protocol) server on your Ubuntu 20.04 system. This FTP setup provides a reliable and efficient means of sharing and managing files across your network. Whether you’re collaborating with colleagues, maintaining remote backups, or facilitating data transfers, your FTP server is primed to meet your file-sharing needs.

With FTP in place, you’ve unlocked a valuable tool for seamless file exchange in today’s digital world. While it’s essential to acknowledge FTP’s lack of inherent encryption for data in transit, this protocol remains a widely used and versatile option for file transfers. To enhance security, consider using alternatives like FTPS (FTP Secure) or SFTP (SSH File Transfer Protocol) that provide encryption and additional security features for your data.

To read more about setting up an SFTP server on Ubuntu 20.04, refer to our blog How to Setup SFTP Server on Ubuntu 20.04

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *