Home  »  ArticlesGuidesHow ToSoftwareTechnologyTools   »   How to Install and Configure VSFTPD In Ubuntu 24.04 Noble Numbat

How to Install and Configure VSFTPD In Ubuntu 24.04 Noble Numbat

If you’re looking to set up an FTP server on Ubuntu 24.04 Noble Numbat, VSFTPD (Very Secure FTP Daemon) is a great choice. It’s secure, fast, and stable, making it one of the most popular FTP servers available. In this guide, we’ll walk you through the steps to install and configure VSFTPD on your Ubuntu 24.04 system.

Prerequisites

Before we start, make sure you have the following:

  1. A fresh installation of Ubuntu 24.04 Noble Numbat.
  2. A user account with sudo privileges.
  3. Basic knowledge of using the terminal.

Step 1: Update Your System

First, ensure your system is up-to-date by running the following commands:

$ sudo apt update
$ sudo apt upgrade -y

Step 2: Install VSFTPD

Next, install the VSFTPD package using the APT package manager:

$ sudo apt install vsftpd -y

Step 3: Backup the Default Configuration File

Before making any changes, it’s a good idea to back up the default configuration file:

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

Step 4: Configure VSFTPD

Open the VSFTPD configuration file in your preferred text editor. Here, we’ll use nano:

$ sudo nano /etc/vsftpd.conf

Make the following changes to the file:

  1. Uncomment the following lines by removing the # at the beginning:
write_enable=YES
local_umask=022
  1. Add the following lines to the end of the file to enhance security and functionality:
chroot_local_user=YES
allow_writeable_chroot=YES
pasv_min_port=10000
pasv_max_port=10100
user_sub_token=$USER
local_root=/home/$USER/ftp
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
  • write_enable=YES allows FTP write commands.
  • local_umask=022 sets the default file permissions.
  • chroot_local_user=YES locks users into their home directories.
  • allow_writeable_chroot=YES allows write access to the chroot directory.
  • pasv_min_port and pasv_max_port define the range of ports for passive mode.
  • user_sub_token=$USER substitutes the username in the path.
  • local_root=/home/$USER/ftp sets the FTP directory.
  • userlist_enable=YES enables the user list.
  • userlist_file=/etc/vsftpd.userlist specifies the user list file.
  • userlist_deny=NO allows only the users in the user list to connect.

Step 5: Create FTP Directory and Set Permissions

Create a dedicated FTP directory for the user and set the appropriate permissions:

$ sudo mkdir -p /home/$USER/ftp
$ sudo chown nobody:nogroup /home/$USER/ftp
$ sudo chmod a-w /home/$USER/ftp

Next, create a directory for file uploads and set the correct ownership:

$ sudo mkdir /home/$USER/ftp/files
$ sudo chown $USER:$USER /home/$USER/ftp/files

Step 6: Add FTP User

If you don’t already have a user account for FTP access, create one and set a password:

$ sudo adduser ftpuser

Add the user to the VSFTPD user list:

$ echo "ftpuser" | sudo tee -a /etc/vsftpd.userlist

Step 7: Restart VSFTPD Service

After configuring VSFTPD, restart the service to apply the changes:

$ sudo systemctl restart vsftpd

Step 8: Allow FTP Traffic through the Firewall

If you have a firewall enabled, allow FTP traffic:

$ sudo ufw allow 20/tcp
$ sudo ufw allow 21/tcp
$ sudo ufw allow 10000:10100/tcp
$ sudo ufw reload

Step 9: Test the FTP Server

You can now test your FTP server using an FTP client like FileZilla or the command line. Connect using your server’s IP address, the FTP user (ftpuser), and the password you set.

Conclusion

Congratulations! You have successfully installed and configured VSFTPD on Ubuntu 24.04 Noble Numbat. With this setup, you can securely transfer files to and from your server. Remember to keep your system and VSFTPD updated to ensure continued security and performance.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.