How to Setup VsFTPD Service with SSL/TLS on CentOS 7.1 / RHEL 7.1 / Oracle Linux 7

Share this Article :

Setup VsFTPD ServiceIf you have your own dedicated server or virtual private server (VPS) that run in linux operating system to host your website or blog, it is recommended to install and Setup ftp Service in order to facilitate the transfer of files and update your website. Among the well-known FTP software is VsFTPD. VsFTPD means “Very Secure FTP Daemon” is the free FTP for Linux and UNIX operating systems, which are very stable, fast and safe to use even if the server is in the internet. Any server in the internet is vulnerable to intruders that may spying on data transfer and steal confidential information such as id and password if encryption is not configured. In this article, I will share the basic steps to setup VsFTPD service with SSL/TLS encryption on CentOS 7.1, RHEL 7.1 and Oracle Linux 7 operating system.

Steps to Setup VsFTPD Service with SSL/TLS

1. Install and setup VsFTPD Service :

[[email protected] ~]# yum install vsftpd -y

2. Add ftp user :

[[email protected] ~]# useradd user1
[[email protected] ~]# passwd user1
Changing password for user user1.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

3. Now Edit VsFTPd configuration file /etc/vsftpd/vsftpd.conf :

Enable the following :

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
# 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.

Optionaly. you can customize the banner :

# You may fully customise the login banner string:
ftpd_banner=Welcome to ehowstuff FTP service.

4. Create ssl and private directory :

[[email protected] ~]# mkdir -p /etc/vsftpd/ssl
[[email protected] ~]# mkdir -p /etc/vsftpd/ssl/private/

5. Create a SSL certificate using on of following command :

[[email protected] ~]# openssl req -x509 -nodes -days 720 -newkey rsa:2048 -keyout /etc/vsftpd/ssl/private/vsftpd.key -out /etc/vsftpd/ssl/vsftpd.pem

You will be prompted with a series of question, which you answer as they appear :

Example :

[[email protected] ~]# openssl req -x509 -nodes -days 720 -newkey rsa:2048 -keyout /etc/vsftpd/ssl/private/vsftpd.key -out /etc/vsftpd/ssl/vsftpd.pem
Generating a 2048 bit RSA private key
writing new private key to '/etc/vsftpd/ssl/private/vsftpd.key'
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [XX]:MY
State or Province Name (full name) []:Malaysia
Locality Name (eg, city) [Default City]:Kuala Lumpur
Organization Name (eg, company) [Default Company Ltd]:ehowstuff
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []:centos7
Email Address []:[email protected]

6. Assign the permission :

[[email protected] ~]# chmod 400 /etc/vsftpd/ssl/vsftpd.pem
[[email protected] ~]# chmod 400 /etc/vsftpd/ssl/private/vsftpd.key

7. Edit vsftpd configuration file /etc/vsftpd/vsftpd.conf. Specify the location of our certificate and key files then add the following line at the bottom of vsftpd.conf :

# Add follows to the bottom


8. Stop and Start VsFTPD Service and make it auto start at boot :

[[email protected] ~]# systemctl stop vsftpd
[[email protected] ~]# systemctl start vsftpd
[[email protected] ~]# systemctl enable vsftpd

9. Check VsFTPD status :

[[email protected] ~]# systemctl status vsftpd
vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled)
   Active: active (running) since Sat 2014-12-13 10:31:30 MYT; 34s ago
  Process: 20864 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 20865 (vsftpd)
   CGroup: /system.slice/vsftpd.service
           ââ20865 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

Dec 13 10:31:30 centos7.ehowstuff.local systemd[1]: Starting Vsftpd ftp daemon...
Dec 13 10:31:30 centos7.ehowstuff.local systemd[1]: Started Vsftpd ftp daemon.

10. From client PC, open filezilla and connect to your server and enter info, for encryption field, select “explicit FTP over TLS”.

Click the check box “Always trust certificate in the future sessions.” Then clik OK to proceed.

Leave a Reply