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

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, usernames and files to hackers. Very Secure FTP Daemon (VSFTPD) is adopted to secure these transfers using SSL-TLS to Centos 7 FTP Server.

This short tutorial is highly important for Intermediate Level System Administrators and Users who usually transfer highly confidential data (documents, images, e.t.c) to their company’s or organization’s FTP servers from Windows PCs using FileZilla.

Special note: consult HostAdvice’s  Best Linux hosting services page to find the leading web hosts in this category, including expert and user reviews.


Install vsftpd and openssl packages on the Centos 7 Linux server

$ sudo yum install vsftpd openssl mod_ss

Switch to root user and enter root password

FTP data is usually insecure since information (usernames, passwords, commands, data) is transmitted unencrypted in clear text. Therefore it’s very IMPORTANT to encrypt the FTP connection using SSL/TLS.

Generate a self-signed certificate to secure the FTP server connections.

$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 –keyout /etc/vsftpd/vsftpd.key -out /etc/vsftpd/vsftpd.pem



Edit the configuration file /etc/vsftpd/vsftpd.conf

$ sudo vim /etc/vsftpd/vsftpd.conf

Ensure configurations as shown below:

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).


#Path to share and send files from


#Enable SSL


#DO NOT allow anonymous users to use SSL


#Force local users to use SSL



#Enable latest SSL and TLS version 1 and disable old versions




#Path to certificate file



# Uncomment this to allow local users to log in.

# When SELinux is enforcing check for SE bool ftp_home_dir



# Uncomment this to enable any form of FTP write command.



Configure Firewall

Enable vsftpd connections via firewall-cmd

$ sudo firewall-cmd --permanent --add-service=ftp


$ sudo firewall-cmd --permanent --add-port=21/ftp
$ sudo firewall-cmd –reload

Special Note: Vsftpd also uses ssh port i.e. 22 so ensure firewall-cmd allows for ssh connections

Add FTP User

Create the ftp root directory

$ sudo mkdir –p /srv/ftp

Switch to root user and enter root password

$ su –

As root, create user that’s allowed to login into the ftp directory

# useradd –d /srv/ftp/ ftpuser

-d Set /srv/ftp as the home directory for ftpuser

Set the password for the ftpuser

# passwd ftpuser

Set the ftp root directory to be owned by ftpuser

# chown –R ftpuser /srv/ftp

Switch back from root user

# su - linuxuser

Start the VSFTPD service

$ sudo systemctl start vsftpd

Confirm VSFTPD service is running

$ sudo systemctl status

Conduct FTP Login Test

Login from Windows Client Machine using FileZilla

If you try to login the default way without SSL, it will fail to login and produce an error as shown below:

Now try accessing using SSL as shown below:

Go to File > Site Manager

Click “New Site” and name it “Very Secure FTP”

While on General Tab:

Host: Enter the public ip address or domain name or hostname

Protocol: Select “SFTP – Secure Shell File Transfer Protocol”

Logon Type: Select “Ask for Password”

Enter the username and password for ftp user.

Finally click on “Connect”

Enter password upon prompt:

Note the successful connection.

Special Note: Please note this will work ONLY IF either of the following are done:

  1. Password Authentication is enabled in /etc/ssh/sshd_config/

  2. If Password Authentication is disabled and only SSH Keys Private Authentication is enabled, you have to configure Filezilla ssh keys private key authentication with the Linux Server. ilezilla-Edit-Go to Edit > Settings

Select SFTP > Add Key File.

Then choose the private key that you;ve used to authenticate with the public key in the Linux Server.

Check out the top 3 Linux hosting services

AU$2.71 /mo
Starting price
Visit FastComet
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing
AU$6.05 /mo
Starting price
Visit Kamatera
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing
AU$3.76 /mo
Starting price
Visit HostArmada
Rating based on expert review
  • User Friendly
  • Support
  • Features
  • Reliability
  • Pricing

How to Set Up SSH on a CentOS 7 VPS from a Windows Client

Download puttygen into the Windows machine as shown in figure 1. Then sta
4 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester

How to install Django on a CentOS 7 VPS or Dedicated Server

When building a website, similar components are required, and you do not have to
3 min read
Mark Armistead
Mark Armistead

How to Install the MEAN Stack on Your CentOS 7 VPS or Dedicated Server

This how-to article will show you how to install the MEAN (MongoDB, Express, Ang
2 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO

How to Install the LAMP Stack on Your CentOS 7 VPS or Dedicated Server

LAMP represents a group of software applications that are used together to run a
3 min read
Max Ostryzhko
Max Ostryzhko
Senior Web Developer, HostAdvice CTO 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