An FTP (File Transfer Protocol) server allows you to upload, download, and manage files on your Linux VPS remotely. This guide will walk you through installing, configuring, and securing an FTP server using VSFTPD (Very Secure FTP Daemon).
📌 Prerequisites
-
A Linux VPS (Ubuntu, Debian, CentOS, or AlmaLinux) from VolticHost
-
Root or sudo user access
-
Port 21 open in the firewall
1️⃣ Update Your System
Before installing anything, update your package list.
For Ubuntu/Debian, run:
sudo apt update && sudo apt upgrade -y
For CentOS/AlmaLinux/RockyLinux, run:
sudo yum update -y
✅ Your system is now up to date!
2️⃣ Install VSFTPD
For Ubuntu/Debian
sudo apt install vsftpd -y
For CentOS/AlmaLinux
sudo yum install vsftpd -y
Start and enable the FTP service:
sudo systemctl start vsftpd
sudo systemctl enable vsftpd
✅ VSFTPD is now installed and running!
3️⃣ Configure VSFTPD
-
Open the VSFTPD configuration file:
sudo nano /etc/vsftpd.conf
-
Find and modify the following settings:
-
Allow local users to access FTP:
local_enable=YES
-
Enable file uploads:
write_enable=YES
-
Restrict users to their home directory:
chroot_local_user=YES
-
Enable passive mode (useful for firewalls):
pasv_enable=YES pasv_min_port=40000 pasv_max_port=50000
-
-
Save and exit (
CTRL + X
, thenY
, thenEnter
). -
Restart VSFTPD to apply changes:
sudo systemctl restart vsftpd
✅ VSFTPD is now configured!
4️⃣ Create an FTP User
-
Create a new FTP user (replace
ftpuser
with your username):sudo adduser ftpuser
-
Set a password for the user:
sudo passwd ftpuser
-
Restrict the user to their home directory:
sudo usermod -d /home/ftpuser ftpuser
✅ Your FTP user is now set up!
5️⃣ Open FTP Ports in the Firewall
For Ubuntu/Debian (UFW)
sudo ufw allow 21/tcp
sudo ufw allow 40000:50000/tcp
sudo ufw enable
For CentOS/AlmaLinux (Firewalld)
sudo firewall-cmd --permanent --add-service=ftp
sudo firewall-cmd --permanent --add-port=40000-50000/tcp
sudo firewall-cmd --reload
✅ Your FTP server is now accessible remotely!
6️⃣ Connect to the FTP Server
Using FileZilla (GUI-Based)
-
Download and install FileZilla from https://filezilla-project.org.
-
Open FileZilla and click File → Site Manager.
-
Click New Site and enter the following details:
-
Host: Your VPS IP
-
Port:
21
-
Protocol: FTP - File Transfer Protocol
-
Logon Type: Normal
-
Username:
ftpuser
-
Password: Your password
-
-
Click Connect to access your FTP server.
✅ You can now transfer files securely!
7️⃣ Secure Your FTP Server (Optional)
Disable Anonymous FTP Access (Recommended)
-
Open the VSFTPD configuration file:
sudo nano /etc/vsftpd.conf
-
Find and change:
anonymous_enable=NO
-
Restart VSFTPD:
sudo systemctl restart vsftpd
Use FTPS (SSL Encryption)
To enable FTPS (FTP Secure), install an SSL certificate and modify vsftpd.conf
:
-
Install OpenSSL:
sudo apt install openssl -y
-
Generate a self-signed SSL certificate:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem
-
Edit
vsftpd.conf
and add:ssl_enable=YES rsa_cert_file=/etc/ssl/private/vsftpd.pem
-
Restart VSFTPD:
sudo systemctl restart vsftpd
✅ Your FTP server is now encrypted with FTPS!
🎉 Conclusion
You've successfully set up an FTP server on a Linux VPS using VSFTPD! You can now securely transfer files between your VPS and local machine. 🚀
For more assistance, contact VolticHost Support.