7 C
Texas
angeloma
Senior Writer and partner

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

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:

- Advertisement -
:~$ 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 vsftpd

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.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

12 COMMENTS

  1. there’s a typo in your command:

    sudo systemctl status vsftp

    correct command:
    sudo systemctl status vsftpd

    thank you for posting!

  2. Got an error:

    r@prime:~$ sudo systemctl status vsftpd
    ● vsftpd.service – vsftpd FTP server
    Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Mon 2019-11-25 21:01:55 EET; 34s ago
    Process: 4182 ExecStartPre=/bin/mkdir -p /var/run/vsftpd/empty (code=exited, status=0/SUCCESS)
    Process: 4183 ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf (code=exited, status=2)
    Main PID: 4183 (code=exited, status=2)

    ноя 25 21:01:55 prime systemd[1]: Starting vsftpd FTP server…
    ноя 25 21:01:55 prime systemd[1]: Started vsftpd FTP server.
    ноя 25 21:01:55 prime systemd[1]: vsftpd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
    ноя 25 21:01:55 prime systemd[1]: vsftpd.service: Failed with result ‘exit-code’.
    r@prime:~$

    Any ideas(it is Debian 10 64 bit)

  3. Thanks for your instructions, very helpfull. I only think that you should point out first, that Debian10 comes with a running SFTP service at port 22 and that from a point of security that is the preference. Especially with everybody using wifi and living close together.
    However, like in my case, I need a port21FTP session to start on my local LAN so no security issues (I don’t live in a city nor do I have neighbours), that’s my second comment the port you mention is a data-channel port 20. Not the FTP service/command port 21 which is the default and works immediately after install.
    Last but not least, the addition of a new ftp-user is very good but should be recommended also, I think, because it is otherwise tempting to use root/admin user “because it works” and therefor introducing logins (id/pwd) at root level to be present at other systems that use this FTP service. Just security wise.
    By the way; the use of a pipe command && results in an error if at the stage something goes wrong. I didn’t see that coming on a virgin new Debian10 install, but I had to do ‘repairs’ to get it fixed with “sudo apt –fix-broken install”.
    Thanks for the inspiration! Ernie.

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article