Debian

How to Setup vsftpd FTP Server on Debian 10?

Vsftpd (Very Secure FTP Daemon), licensed under GNU General Public License, is an FTP protocol used to transfer files to and from a remote network. It is a secure, stable, and fast FTP server that is supported on Linux/UNIX operating systems. In this post, we will learn how to set up a vsftpd FTP server on the Debian system.

Note: The commands have been tested on the latest release of Debian i.e., Debian 10.

Setup vsftpd FTP Server on Debian 10

Follow the below steps in order to setup vsftpd server on Debian 10:

Step 1: Install VSFTPD

First, update the repository index using the below command in Terminal:

$ sudo apt update

Now, you can install vsftpd as follows:

$ sudo apt install vsftpd

The system might prompt you for a sudo password and might also prompt you with the Y/n (yes/no) option for proceeding with the installation of vsftpd. Press Y to proceed.

After the installation is finished, you can verify it using the below command:

$ vsftpd -versions

Step 2: Allow FTP in the firewall

If a firewall is running on your machine, allow ports 20 and 21 for FTP traffic. To check if a firewall is running, run the below command in Terminal:

$ sudo ufw status

If you see “active” status in the output, it means the Firewall is running on your system.

Now to allow port 20 and 21, run the below command in Terminal:

$ sudo ufw allow 20/tcp
$ sudo ufw allow 21/tcp

Now to confirm if the rules have been added, run the below command in Terminal:

$ sudo ufw status

The below output shows the Firewall has allowed the FTP ports.

Step 3: Configuring FTP Access

Now we will do some basic configurations for the FTP server. But before going for configurations, let’s make a backup of the vsftpd configuration file using the below command in Terminal:

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

Now edit the vsftpd configuration file as follows:

$ sudo nano /etc/vsftpd.conf

Now modify the configurations to match them as follows:

listen=YES
listen_ipv6=NO
connect_from_port_20=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
pasv_enable=YES
pasv_min_port=40000
pasv_max_port=45000
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO

Now save and close the vsftpd.conf configuration file.

Step 4: Add FTP user

Now, we will add a user to the allowed FTP users list. For testing purposes, we will create a new user account named “tin”, and then set its password.

To create a new FTP user, use the following command:

$ sudo adduser tin

Then set its password using the command below:

$ sudo passwd tin

Add the user to the allowed FTP users list:

$ echo "tin" | sudo tee -a /etc/vsftpd.userlist

Step 5: Restart VSFTPD service

Once you have finished the configurations, restart the vsftpd service. Run the command below to do so:

$ sudo systemctl restart vsftpd

To enable the vsftpd as a startup, run the following command in the Terminal:

$ sudo systemctl enable vsftpd

Step 6: Test FTP Access

We have configured the FTP server to allow access to only user “tin”. Now to test it, you will need an FTP client. We will use here the Filezilla as the FTP client.

You can install the Filezilla as follows:

$ sudo apt install filezilla

To launch Filezilla, either search it through the Applications list or simply execute the following command in Terminal:

$ filezilla

This will be the default view you will see when you launch the Filezilla.

Now to connect to the FTP server, we will require its IP address. You can find the IP address of your FTP server by entering the command in Terminal:

$ ip a

The below output shows the IP address of our FTP server is 192.168.72.189.

In the Filezilla window, type the IP address of the vsftpd FTP server, username, and password in their respective fields. Then, click Quick connect to connect to the vsftpd FTP server.

Once you are connected to the FTP server, try uploading and downloading the files to and from the FTP server, respectively.

Conclusion

That is all there is to it! In this post, we have covered how to setup vsftpd FTP server on Debian 10 machine. Now, you can easily access and upload/download files to and from your FTP server, respectively.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.