Config Server Firewall

How to Install and Configure FTP Server on Ubuntu 24 (vsftpd)

In this tutorial, we’ll walk you through the process of installing and configuring an FTP server on Ubuntu 24 using VSFTPD.

We'll cover installing the VSFTPD package, setting up essential configurations including write access and passive mode, and finally configuring the firewall to allow connections to your new FTP server.

Step 1: Install vsftpd

To get started, open a terminal, update the package list, and install vsftpd:

sudo apt update
sudo apt install vsftpd

Step 2: Configure vsftpd

Now we need to configure vsftpd by editing the main configuration file located at /etc/vsftpd.conf. But before making any changes, it's a good idea to backup the original file:

sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.backup

Then, open the vsftpd.conf file and set the following settings:

local_enable=YES
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES

Also, add the passive FTP configuration at the end of the file. You can choose a different port range for passive connections—just make sure the range isn’t used by other services:

pasv_enable=Yes
pasv_min_port=50000
pasv_max_port=51000

Step 3: Restart vsftpd and Check Status

Save the file and restart the vsftpd service to apply the changes:

sudo systemctl restart vsftpd

After restarting vsftpd, check the status to make sure there are no errors:

sudo systemctl status vsftpd

If there are any errors, they are most likely due to a syntax issue in the config file.

Step 4: Open Firewall Ports (Optional)

If your Ubuntu 24 server is behind a firewall, make sure to allow port 21 and the passive port range.

For UFW firewall users, you can use these commands:

sudo ufw allow 21/tcp
sudo ufw allow 50000:51000/tcp

Connecting to Your FTP Server

You can now connect to the Ubuntu FTP server using any system user account and password on your Ubuntu system.

Remember that, when you connect to the FTP Server, you’ll be accessing that user’s home directory and be restricted to it.

If you want to access a different folder—for example, /srv/ftp—you can create a new Linux user and set that as their home directory:

adduser ftpuser --home /srv/ftp
chown -R ftpuser /srv/ftp

Managing FTP (VSFTPD) Server

To start, stop, or restart vsftpd, use the systemctl command:

sudo systemctl start vsftpd
sudo systemctl stop vsftpd
sudo systemctl restart vsftpd

Set vsftpd to start automatically (default):

sudo systemctl enable vsftpd

Disable vsftpd from starting automatically on boot:

sudo systemctl disable vsftpd

To check the status of the vsftpd service, run:

sudo systemctl status vsftpd
systemctl is-enabled vsftpd

FTP Server Ready on Ubuntu 24

That's it! You've now installed and configured a basic FTP server on your Ubuntu 24 system using VSFTPD.

Next, read our tutorial on how to install a VNC server if you want to set up remote desktop access and use the graphical interface on your Ubuntu Server.