How to set up an FTP server on Debian 10 Buster?

0
139

An FTP server, although for many it can be a bit old-fashioned, is quite useful. Especially in computer networks where you need to share files internally. Or even if we are in a house with several computers, it would also be useful. Best of all, it is still easy to set up one and more on Debian 10. So in this post, you will learn how to set up an FTP server on Debian 10. For that, we will use VSFTPD as the FTP daemon.

Configuring an FTP Server on Debian 10

First of all, you need root access. Either the user is active and has the password, or your user is enabled to use Sudo.

In any case, we also require you to establish a connection to the Debian server using SSH or locally with a terminal session.

1.- Upgrade the system

Before any installation, the main thing is to update the system. This way it will be safer to continue:

:~$ sudo apt update && sudo apt upgrade

This way your Debian 10 system will have the necessary security patches installed.

2.- Install VSFTPD on Debian 10

Now we will install the FTP daemon that we have chosen. In this case, it is VSFTPD. The advantage of using it is that it is easy to configure and is in the Debian 10 repositories.

:~$ sudo apt install vsftpd

Next, check the service status:

:~$ sudo systemctl status vsftp
1.- FTP service is running
1.- FTP service is running

So, the service is running.

3.- Configure the FTP server

The VSFTPD configuration can be found at /etc/vsftpd.conf. Before modifying the contents of the configuration file, it is recommended to make a backup. If something goes wrong we will be able to restore and nothing bad will have happened.

:~$ sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak

Now, we can start with the work.

:~$ sudo nano /etc/vsftpd.conf

The file is somewhat extensive but it is because it is very well documented. The truth is simple to manipulate. First, make the service “listen” and if you don’t use IPV6, disable it.

listen=YES
#listen_ipv6=NO

By default, VSFTPD does not let you change the assigned folder. That is, it will only allow the download but not the upload. If you want to change this, leave the following directive like this:

write_enable=YES

The default port is 20 but you can change it:

#connect_from_port_20=YES
listen_port=21

Here comes a slightly delicate matter. It is normal that when we use an FTP server we have to create users who use it. The problem is that some users can upload and delete files from other users. This should be avoided. It is necessary to define what each user has his folder and that he cannot modify or see the others.

chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

Now you have to create the file with the list of users. Note that in this step, I have added a user called test1. That is the name of the user I will create later.

:~$ sudo nano /etc/vsftpd.chroot_list
angelo
test1

The pasv_min_port and pasv_max_port directives define the range of ports that will passively work FTP. These ports must be accessible if you use a Firewall.

At the end your configuration file will look like this:

:~$ sudo cat /etc/vsftpd.conf | grep -v "^#"
2.- VSFTPD file config
2.- VSFTPD file config

Next, create the new user:

:~$ sudo adduser test1
3.- Creating a new user
3.- Creating a new user

Next, reload the VSFTPD service.

:~$ sudo systemctl restart vsftpd

And check the status:

:~$ sudo systemctl status vsftpd
4.- VSFTPD is running properly after the changes
4.- VSFTPD is running properly after the changes

4.- Test the FTP server on Debian 10

Open a web browser and go to ftp://your-server/ and you will see this.

5.- FTP interface on the web browser
5.- FTP interface on the web browser

It is anonymous access if you do not want it, open your configuration file and define this:

anonymous_enable=NO

Save the file and restart the service.

So, you can also install Filezilla which is an FTP client.

:~$ sudo apt install filezilla

Once the program is open, go to the File menu. Next, click on the Site Manager option. Then define your configuration:

6.- Configuring Filezilla
6.- Configuring Filezilla

So, you can enjoy your FTP server on Debian 10.

7.- The FTP server is running
7.- The FTP server is running

Conclusion

In this post, you have learned how to set up an FTP server on Debian 10. The process is simple to follow and can be useful in-the home or even business servers.

Please share this post with your friends through social networks. We also invite you to join us in our telegram channel.

LEAVE A REPLY

Please enter your comment!
Please enter your name here