How to Install vsftpd FTP Server in Ubuntu 18.04

In the previous tutorial we learned how to setup LAMP stack on Ubuntu 18.04. This tutorial explains how to install FTP Server on Ubuntu 18.04 using vsftpd.

We don't need to FTP to run a web server, but we need a way to transfer resources to the server. There are lots of different ways to transfer files between server and client, but the most popular method is FTP which stands for File Transfer Protocol.

There are a couple of FTP server solutions available for Ubuntu, one we are going to use is VSFTPD which stands for very secure FTP daemon.

We need to start by installing the vsftpd package:

sudo apt-get update
sudo apt-get install vsftpd

The default configuration file for the FTP server located at /etc/vsftpd.conf. Open the configuration file and configure following directives as follows (uncomment the directives if it is commented ).


Next, Restart the vsftpd service to apply changes:

sudo systemctl restart vsftpd

To view the FTP server status, Run:

sudo systemctl status vsftpd

Now you can use any FTP client to connect to your Ubuntu FTP server. The most popular one is FileZilla.

Note that you need to add firewall rule to open port 21 if you have enabled Ubuntu Firewall:

sudo ufw allow 21/tcp

When create an FTP user, make sure that the user's home directory is the location that you want access through the FTP. For example, following command will create a new user called ftpuser1 under the /var/www/ directory.

sudo adduser --home /var/www/ ftpuser1

How it works…

In this tutorial we learned how to install and configure an FTP server on Ubuntu 18.04. We used vsftpd, which is the default FTP package in Ubuntu Linux.

Under the Vsftpd configuration, we have modified a couple of settings. First We disable anonymous FTP access to the server, next we allowed local users to log in and enabled write access.

Then we put users into the chroot jail. The chroot_local_user=YES directive restricts users to their home directory and preventing them from accessing anything else outside of the home directory.

What Next? In the next tutorial we are going to learn how to configure vsftpd to work with passive mode in Ubuntu Linux.