How To Install VSFTPD on Ubuntu 18.04

Installing a basic FTP server into Ubuntu 18.04 Bionic Beaver using vsftpd is a straightforward process. In this article we will cover installing the basic packages needed, setting up a user, setting up encryption, and then test connecting to it.

Install vsftpd

  1. Enter the Following Command to Install vsftpd
sudo apt-get install vsftpd -y
  1. Start the vsftpd Service and Set It to Start on Boot
sudo systemctl start vsftpd
sudo systemctl enable vsftpd

Setup Directory Structure For FTP

  1. Create a User
sudo adduser testuser1
  1. Create a Directory and Set Ownership
sudo mkdir /home/testuser1/ftp
sudo chown nobody:nogroup /home/testuser1/ftp
sudo chmod a-w /home/testuser1/ftp

 

  1. Create a Directory Where Files Can Be Uploaded and Give Ownership to the Test User
sudo mkdir /home/testuser1/ftp/test
sudo chown testuser1:testuser1 /home/testuser1/ftp/test

Configure vsftpd

  1. Backup vsftpd’s Original Config File
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
  1. Open and Edit the vsftpd.conf File
sudo nano /etc/vsftpd.conf
  1. Add the Following to 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
pasv_enable=Yes
pasv_min_port=10000
pasv_max_port=11000
user_sub_token=$USER
local_root=/home/$USER/ftp
userlist_enable=YES
userlist_file=/etc/vsftpduserlist.conf
userlist_deny=NO
  1. Save and Close the Config File

vsftpd has many configuration options so you may need to make further adjustments based on your local server setup.

  1. Add The testuser1 User We Created to vsftpd’s User List File
        sudo nano /etc/vsftpduserlist.conf
  1. Restart the vsftpd Service to Apply These Changes
sudo systemctl restart vsftpd

Setup Security with SSL/TLS

  1. Create a Security Certificate
sudo mkdir /etc/certs

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/certs/vsftpd.pem -out /etc/certs/vsftpd.pem
  1. Open the vsftpd.conf File
sudo nano /etc/vsftpd.conf

  1. Add the Following Lines to the File
rsa_cert_file=/etc/certs/vsftpd.pem
rsa_private_key_file=/etc/certs/vsftpd.pem
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
  1. Save the File and Restart vsftpd
sudo systemctl restart vsftpd

To test, configure your favorite FTP client to connect to your server and make sure to set the encryption settings when you login.

How To Install VSFTPD on Ubuntu 18.04

You should see the FTP server contents upon login.

How To Install VSFTPD on Ubuntu 18.04

Check out these top 3 Best web hosting services

HostArmada
$2.49 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.5
  • Features
    4.5
  • Reliability
    4.5
  • Pricing
    4.0
A2 Hosting
$2.99 /mo
Starting price
Visit A2 Hosting
Rating based on expert review
  • User Friendly
    4.5
  • Support
    4.0
  • Features
    4.5
  • Reliability
    4.8
  • Pricing
    4.0
Hostens
$0.90 /mo
Starting price
Visit Hostens
Rating based on expert review
  • User Friendly
    4.5
  • Support
    3.8
  • Features
    4.3
  • Reliability
    4.5
  • Pricing
    4.8

How To Configure Nginx to use Self-Signed SSL/TLS Certificate on Ubuntu 18.04 VPS or Dedicated Server

This tutorial will help you create a self-signed SSL certificate and configure N
7 min read
David Malcom
David Malcom
Author

How to Install a Let’s Encrypt Certificate on your Ubuntu 18.04 Dedicated Server or VPS

If you are hosting your website on a VPS server running Ubuntu 18.04, we will sh
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How To Configure vsftpd for a User’s Directory on an Ubuntu 18.04 VPS or Dedicated Server

This tutorial will enable you to install and configure vsftpd on Ubuntu 18.04 to
8 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert

How to Install a Self-Signed SSL Certificate on Your Ubuntu 18.04 VPS or Dedicated Server

This how-to article will teach you how to create a self-signed SSL certificate o
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester
HostAdvice.com provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.