How to Install and Configure vsftpd on Ubuntu 18.04

How to Install and Configure 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
  2. 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
  2. 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
  3. 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
  2. Open and Edit the vsftpd.conf File
    sudo nano /etc/vsftpd.conf
  3. 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
  4. 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.
  5. Add The testuser1 User We Created to vsftpd’s User List File
    sudo nano /etc/vsftpduserlist.conf
  6. 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
  2. Open the vsftpd.conf File
    sudo nano /etc/vsftpd.conf
  3. 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
  4. 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.

You should see the FTP server contents upon login.

Check out these top 3 Linux hosting services

FastComet
NZ$3.03 /mo
Starting price
Visit FastComet
Rating based on expert review
  • User Friendly
    4.7
  • Support
    5.0
  • Features
    4.8
  • Reliability
    4.5
  • Pricing
    5.0
HostArmada
NZ$4.22 /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
Hostinger
NZ$5.07 /mo
Starting price
Visit Hostinger
Rating based on expert review
  • User Friendly
    4.7
  • Support
    4.7
  • Features
    4.8
  • Reliability
    4.8
  • Pricing
    4.7

How To Install VSFTPD on Ubuntu 18.04

A guide on installing and configuring vsftpd including setting up encryption
2 min read
Yuriy Gandyak
Yuriy Gandyak
Senior Writer & Hosting Expert

How To Set up a VSFTPD Server on a CentOS 7 VPS or Dedicated Server

Brief Description FTP is usually insecure exposing clear-text passwords, userna
2 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert

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 Set up a VSFTPD Server on an Ubuntu 16.04 VPS or Dedicated Server

Brief Description FTP data is usually insecure since information (usernames, pa
2 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert
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.
Click to go to the top of the page
Go To Top