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:
- A fresh installation of Ubuntu 24.04 Noble Numbat.
- A user account with sudo privileges.
- 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 -yStep 2: Install VSFTPD
Next, install the VSFTPD package using the APT package manager:
$ sudo apt install vsftpd -yStep 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.bakStep 4: Configure VSFTPD
Open the VSFTPD configuration file in your preferred text editor. Here, we’ll use nano:
$ sudo nano /etc/vsftpd.confMake the following changes to the file:
- Uncomment the following lines by removing the
#at the beginning:
write_enable=YES
local_umask=022- 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=NOwrite_enable=YESallows FTP write commands.local_umask=022sets the default file permissions.chroot_local_user=YESlocks users into their home directories.allow_writeable_chroot=YESallows write access to the chroot directory.pasv_min_portandpasv_max_portdefine the range of ports for passive mode.user_sub_token=$USERsubstitutes the username in the path.local_root=/home/$USER/ftpsets the FTP directory.userlist_enable=YESenables the user list.userlist_file=/etc/vsftpd.userlistspecifies the user list file.userlist_deny=NOallows 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/ftpNext, create a directory for file uploads and set the correct ownership:
$ sudo mkdir /home/$USER/ftp/files
$ sudo chown $USER:$USER /home/$USER/ftp/filesStep 6: Add FTP User
If you don’t already have a user account for FTP access, create one and set a password:
$ sudo adduser ftpuserAdd the user to the VSFTPD user list:
$ echo "ftpuser" | sudo tee -a /etc/vsftpd.userlistStep 7: Restart VSFTPD Service
After configuring VSFTPD, restart the service to apply the changes:
$ sudo systemctl restart vsftpdStep 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 reloadStep 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.
