Install and configure FTP Server on Ubuntu 18

How to Install FTP Server on Ubuntu? What is FTP? FTP is a client server protocol that allows two communication channels between client and server. Steps to install FTP? Find out more.

Updated: 05 Mar, 23 by Elizabet J 5 Min

List of content you will read in this article:

Using a computer for your typical daily tasks is, for the most part, pretty easy. What goes on “under the hood”, however, is a completely different story. There are extremely complex technologies and protocols that make sure you can send and receive data over the internet. One such protocol is FTP.

Today, we will shortly explain the FTP protocol, what it can be used for, and follow up with a detailed step-by-step tutorial on how to install FTP server on Ubuntu, configure it, and activate it. Let’s get right into it.

FTP stands for the File Transfer Protocol and is the standard network protocol that is used in order to transfer files between a server and a client using a computer network. More precisely, it uses TCP/IP (i.e., Transmission Control Protocol/Internet Protocol) connections and is considered an application layer protocol.

For the FTP protocol to be usable, both systems (server and client) need to be connected via a computer network, as well as servers need to be configured to run FTP services and clients must have FTP software installed.

While most websites use HTTP or HTTPS protocols to deliver webpages to users, the majority of behind-the-scenes work is done using the FTP protocol. Here are some of the most common use cases for FTP:

  • Data Backups: many backup services utilize FTP in order to conduct regular backups, however, it is simple enough to use that even individual users can backup their important information to a server running FTP services.
  • Replication: while being similar to backups, the approach is slightly more comprehensive, providing increased resilience and better availability. As you probably have guessed by now, replication can be done with FTP.
  • Shared Web Hosting: If you have a shared hosting or cloud hosting service, you have probably already used FTP. It is commonly utilized to access shared web hosting services and to upload data to them.

How to Install FTP Server on Ubuntu 18

Note: At all stages, the commands are logged with Root access, so if you are logged in to Ubuntu 18 by any other user than the Root user, you should enter all commands after the sudo command. 

Step 1:   Connect to your Ubuntu 18 via an SSH client.
Step 2: Type in the following command to update Ubuntu 18 repositories.
apt update
Step 3: Enter the following command to download and install the VSFTP service.
apt install -y vsftpd
Step 4: After the installation is completed, enter the following commands to start and enable the VSFTP service.
systemctl start vsftpd
systemctl enable vsftpd

How to Configure FTP on Ubuntu 18

So far we were able to set up an FTP server on Ubuntu. Let's learn how to set up this service as well as grant access to users to use the file transfer protocol.
Step 1: First, create an account and set up a password for it.
useradd -m Userx
passwd passwordx
Step 2: After entering the second command, you must enter the password twice for this user.
Step 3: Rename the default VSFTP file so that it can be restored in case of an error.
mv /etc/vsftpd.conf/etc/vsftpd.conf.orig
Step 4: Create a new configuration file for VSFTP and open it with an editor. (In our example, we used the nano editor, however, you can also use the Vi editor or any other available editor).
nano /etc/vsftpd.conf
Step 5: Copy the following file into the opened file and save and exit at the end of the file.
listen = NO
listen_ipv6 = YES
anonymous_enable = NO
local_enable = YES
write_enable = YES
local_umask = 022
dirmessage_enable = YES
use_localtime = YES
xferlog_enable = YES
connect_from_port_20 = YES
chroot_local_user = YES
secure_chroot_dir = / var / run / vsftpd / empty
pam_service_name = vsftpd
rsa_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file = /etc/ssl/privacy/ssl-cert-snakeoil.key
ssl_enable = NO
pasv_enable = Yes
pasv_min_port = 10,000
pasv_max_port = 10100
allow_writeable_chroot = YES
Step 6:  When the file is edited, enter the following command to restart the VSFTP service.
systemctl restart vsftpd
With this current configuration, you will have access to the root user interface with which you log into FTP. For example, the address of this directory is for Elizabeth user: home / elizabeth /. This way you have been able to set up FTP on your Ubuntu server. In the end, you only need to configure the ports for this service on your firewall.

Configure the Ubuntu Firewall 18 to Use the FTP service

To get FTP service, enter the following commands to open all necessary ports.
Note: The following commands are listed in the Ubuntu 18 standard for UFW setup. If you use another firewall, you must open the ports required by the following commands in accordance with the same firewall.
ufw allow 20 / tcp
ufw allow 21 / tcp
ufw allow 990 / tcp
ufw allow 10,000: 10100 / tcp
After that, you can connect to your FTP server. If you need to learn more about FTP click here.

We hope that this blog has helped you expand your knowledge about the file transfer protocol. With the simple steps outline in this article, you should be able to install, configure, and activate an FTP server on Ubuntu 18 operating system. If you run into any issues throughout the installation process or have any questions/suggestions, please leave them in the comment section below.

Elizabet J

Elizabet J

One OF my major goals is getting new experiences about ICT and what’s more making progress through this field.