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:
Now, you can install vsftpd as follows:
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:
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:
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 21/tcp
Now to confirm if the rules have been added, run the below command in Terminal:
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:
Now edit the vsftpd configuration file as follows:
Now modify the configurations to match them as follows:
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:
Then set its password using the command below:
Add the user to the allowed FTP users list:
Step 5: Restart VSFTPD service
Once you have finished the configurations, restart the vsftpd service. Run the command below to do so:
To enable the vsftpd as a startup, run the following command in the Terminal:
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:
To launch Filezilla, either search it through the Applications list or simply execute the following command in Terminal:
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:
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.