If you’re managing or configuring a Linux server, setting up an FTP server is one of the essential tasks. FTP (File Transfer Protocol) provides a convenient and reliable way to transfer files between your computer and the server. In this tutorial, I’ll show you how to install and configure the VSFTPD FTP server on Ubuntu 26.04.
When setting up a server to host a website or application, you’ll eventually need a way to upload your website files, application code, images, and other assets. While there are several methods for transferring files, FTP remains one of the simplest and most widely used options for server administration.
In my previous tutorial, I covered how to install Drupal with Nginx and PHP 8.5 on Ubuntu 26.04. If you’re following that guide, you probably have your website files stored on your local computer and need a way to transfer them to your Ubuntu server.
Once VSFTPD is configured, you’ll be able to upload and download files between your local computer and your Ubuntu server using any FTP client. Later in this guide, you can also enable TLS encryption for secure transfers.
With that said, let’s get started.
Prerequisites
- A server with Ubuntu 26.04 installed
- A user with sudo privileges
- UFW installed
Step 1 – Update the Server
As always, let’s update the system first.
sudo apt update -y
sudo apt upgrade -y
Step 2 – Install VSFTPD
The next step is to install VSFTPD. Although there are several FTP servers available, we’ll use VSFTPD because it is lightweight, secure, and widely used on Linux servers.
sudo apt install vsftpd -y
sudo systemctl enable --now vsftpd
Step 3 – Configure VSFTPD
Next, we will configure VSFTPD. Before making any changes, let’s create a backup of the default configuration file.
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
Now let’s configure it
sudo nano /etc/vsftpd.conf
Update the configuration file as shown below.
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
# Chroot users into their home
chroot_local_user=YES
allow_writeable_chroot=YES
# Passive mode for firewalls/NAT
pasv_enable=YES
pasv_min_port=40000
pasv_max_port=40100
# Allowlist specific users only
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
# Improve security hygiene
pam_service_name=vsftpd
seccomp_sandbox=YES
Now restart the VSFTPD service
sudo systemctl restart vsftpd
Step 4 – Create an FTP user
The next step is to create an FTP user. This user will be used for FTP access but wont have shell access.
sudo adduser ftpuser --shell /bin/false
Note:- Make sure to change "ftpuser" as per your wish and keep a record of it and its password somewhere.
Finally, add the user to the VSFTPD allowlist.
echo "ftpuser" | sudo tee -a /etc/vsftpd.userlist
sudo systemctl restart vsftpd
Step 5 – Open FTP port from Firewall
Now let’s open the required FTP ports in the firewall.
sudo ufw allow 21/tcp
sudo ufw allow 40000:40100/tcp
sudo ufw reload
Now let’s restart VSFTPD service
sudo systemctl restart vsftpd
sudo systemctl status vsftpd
If the service is running, you should see Active: active (running). Press “Q” to exit the status screen.
Step 6 – Enable FTPS encryption
To secure our file transfer, we will need to add SSL/TLS encryption on our FTP server. So we will generate a self signed ssl certificate that we can use to secure our data with encryption
sudo openssl req -x509 -nodes -days 3650 \
-newkey rsa:2048 \
-keyout /etc/ssl/private/vsftpd.key \
-out /etc/ssl/private/vsftpd.crt
Now open the configuration file and add the given below fields
sudo nano /etc/vsftpd.conf
Copy and paste the one given below
ssl_enable=YES
allow_anon_ssl=NO
force_local_logins_ssl=YES
force_local_data_ssl=YES
rsa_cert_file=/etc/ssl/private/vsftpd.crt
rsa_private_key_file=/etc/ssl/private/vsftpd.key
# Harden TLS
ssl_sslv2=NO
ssl_sslv3=NO
ssl_tlsv1=NO
ssl_tlsv1_1=NO
ssl_tlsv1_2=YES
ssl_tlsv1_3=YES
require_ssl_reuse=NO
ssl_ciphers=HIGH
Now, restart the VSFTPD service
sudo systemctl restart vsftpd
When connecting with FileZilla or another FTP client, select “Require explicit FTP over TLS” as the encryption method. If you’re using a self-signed certificate, you’ll be prompted to trust it the first time you connect.
Conclusion
With the steps above, you have successfully configured VSFTPD on Ubuntu 26.04 which will help you in transferring files from your server to PC or vice versa. Remember that this configuration doesn’t have to do anything with what application you are going to use.
Frequently asked questions
Can i configure it on any Ubuntu server?
Yes, since this allows you to transfer files between your server and PC, you can configure this on any Ubuntu server.
What will be the FTP password?
FTP password will your “ftpuser” password. So its up to you what you have configured in Step 4.