How to install vsftpd FTP server with TLS on Debian 10

If you’ve ever used FTP before, you may know that it offers a very useful way to transfer files and information from one system to another. FTP, short for File Transfer Protocol, is a common network protocol that can be used to download and upload files, depending on the permissions assigned to the user. For Linux and Unix systems, VSFTPD is used as an FTP server. VSFTPD stands for Very Secure FTP Daemon is an FTP server licensed under the GNU General Public License.

In this article, we will explain how you can install and configure an FTP server using vsftpd in Debian 10. We used Debian10 to describe the procedure mentioned in this article.

Installing FTP Server in Debian

Follow these steps to install VSFTPD-Very secure FTP Daemon on Debian OS.

Step 1: Install VSFTPD

Launch the terminal on your Debian OS by going to the “Actions” tab in the upper left corner of the desktop. Then in the search bar enter Terminal, When the terminal icon appears, click on it to launch it.

Then in the Terminal, enter the following command to update the repositories.

$ sudo apt-get update

When prompted for a password, enter sudo password.

Then run the command below in Terminal to install VSFTPD package:

$ sudo apt-get install vsftpd

Vsftpd installation

After the installation is completed, you can check the version of the VSFTPD package by running the following command in the terminal:

$ vsftpd -versions

check vsftpd version

Step 2. Turn on and start the VSFTPD service.

The VSFTPD service does not start automatically after installation. To start the VSFTPD service, run the following command in the terminal:

$ systemctl start vsftpd

The system will request user authentication. Enter your password and click Authenticate.Advertisements

So that the vsftpd service always starts at boot time, run the following command in the terminal.

$ systemctl enable vsftpd

The system will request user authentication several times. Enter your password and click Authenticate,

Run vsftpd

VSFTPD Configuration

Now we will make some settings necessary to configure the FTP server in our Debian OS.

Step 1. Allow ports in the firewall

If you use a firewall, enable ports 20 and 21 for FTP using the following commands:

$ sudo ufw allow 20/tcp

$ sudo ufw allow 21/tcp

Open FTP port in firewall

After that, confirm it by checking the status of the firewall with the following command:

$ sudo ufw status

Check the status of the firewall

Step 2: Configure FTP Access

Before making any changes to the VSFTPD configuration file, be sure to backup the original vsftpd.config file. You can use the following command to do this.

$ sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig

Configure FTP

Now run the following command in Terminal to edit the vsftpd.config file in the nano editor. You can use any editor for this purpose.

$ sudo nano /etc/vsftpd.conf

Add the following lines to the end of 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
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=Yes
pasv_enable=Yes
pasv_min_port=10000
pasv_max_port=10100
allow_writeable_chroot=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO

When done click Ctrl + O and Ctrl + X save and exit the file.

vsftpd.conf configuration file

Step 3. Restart the VSFTPD service.

To apply the configuration changes made above, you need to restart the vsftpd service. To do this, run the following command:

$ sudo systemctl restart vsftpd

Step 4. Create an FTP User

Now we need to create an ftp user who will be allowed to connect to the ftp server.

Enter the command below to create a user:

$ sudo useradd -m 

Then assign the user created above with the following command:

$ sudo passwd 

In the following example, we created a user named ftpuser and assigned him a password.

Create FTP User

Check FTP connection

To check the FTP connection, you need to install the FTP client on the same or a separate system from which you want to access the FTP server. In our case, we use FileZilla as an FTP client.

Run the following command in Terminal to install FileZilla.

$ sudo apt-get install filezilla

After installation is complete, open FileZilla either using the terminal or from the Dash menu. when opening, enter the necessary information, such as hostname / IP address, username and password, and click Quick connection button.

Check FTP connection with FileZilla

Verify the certificate and click OK Connect to an FTP server.

Accept SSL Certificate

You will be successfully logged in to the FTP server and will be able to access the files and directories of the remote server.

FTP connection successful

Now that you have installed and configured the FTP server, now you can use it to transfer files from the local computer to the remote FTP server and vice versa.

How to install vsftpd FTP server with TLS on Debian 10

Related Posts