How to Set Up vsftpd FTP Server (Very Secure FTP Daemon) on Ubuntu, Debian, Fedora, and Arch Linux
If you need a secure and lightweight FTP server on Linux, vsftpd (Very Secure FTP Daemon) is one of the best options out there. It’s fast, stable, and, as the name implies, secure.
This tutorial will walk you through setting up vsftpd on Ubuntu, Debian, Fedora, and Arch Linux, along with instructions on connecting to it from a local or remote machine.
Let’s dive in!
Step 1: Install vsftpd
The first step is to install vsftpd on your system. The package names are the same across different distributions, but the installation commands vary slightly.
On Ubuntu and Debian
Update your package list and install vsftpd:
sudo apt update
sudo apt install vsftpd
On Fedora
Use dnf to install vsftpd:
sudo dnf install vsftpd
On Arch Linux
Install vsftpd using pacman:
sudo pacman -S vsftpd
Step 2: Start and Enable vsftpd Service
After installing vsftpd, you need to start the service and ensure it runs at boot.
sudo systemctl start vsftpd
sudo systemctl enable vsftpd
To verify it’s running, use:
sudo systemctl status vsftpd
You should see an active status if everything is working properly.
Step 3: Configure vsftpd
Now, let’s edit the configuration file to set up basic FTP functionality.
The configuration file is located at /etc/vsftpd.conf
.
Open it with your preferred text editor (I’ll use nano here):
sudo nano /etc/vsftpd.conf
Basic Settings
Add or modify the following lines to allow local users to upload files, disable anonymous access, and improve security:
# Allow local users to log in
local_enable=YES
# Enable file uploads
write_enable=YES
# Restrict users to their home directories
chroot_local_user=YES
# Limit access to specific users (optional)
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
# Secure the connection
ssl_enable=YES
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
Save and Exit
Press Ctrl + O
to save and Ctrl + X
to exit.
Step 4: Create User for FTP Access (Optional)
If you want to create a specific user for FTP access, you can do it with the following command:
sudo adduser ftpuser
Set a password when prompted. You can also add this user to the allowed list if you enabled userlist
:
echo "ftpuser" | sudo tee -a /etc/vsftpd.userlist
Step 5: Configure Firewall (If Applicable)
If you have ufw (Uncomplicated Firewall) enabled, you need to allow FTP traffic.
On Ubuntu and Debian
sudo ufw allow 20:21/tcp
sudo ufw allow 990/tcp
sudo ufw reload
On Fedora and Arch Linux (firewalld)
sudo firewall-cmd --permanent --add-service=ftp
sudo firewall-cmd --reload
Step 6: Restart vsftpd
After making changes, restart vsftpd to apply the new configuration:
sudo systemctl restart vsftpd
Step 7: Connect to Your FTP Server
Now that your FTP server is set up, let’s connect to it from a local or remote machine.
Connect from the Local Machine
Open a terminal and use the ftp
command:
ftp localhost
Enter your username and password when prompted. Once logged in, you can list files, upload, and download files.
Connect from Another Machine
On another computer within the same network or with SSH access to the server, use the following command to connect:
ftp <server_ip_address>
Replace <server_ip_address>
with the actual IP address of your FTP server.
For example:
ftp 192.168.1.10
When prompted, enter the FTP username and password you created.
Using FileZilla (GUI Client)
If you prefer a graphical client, FileZilla makes it easy to connect.
- Install FileZilla on your system:
- On Ubuntu/Debian:
sudo apt install filezilla
- On Fedora:
sudo dnf install filezilla
- On Arch:
sudo pacman -S filezilla
- On Ubuntu/Debian:
- Open FileZilla and enter the following details:
- Host: IP address of the server (e.g.,
192.168.1.10
) - Username: FTP username
- Password: FTP password
- Port: 21
- Host: IP address of the server (e.g.,
- Click Quickconnect to connect to the server.
You can now browse, upload, and download files easily.
Troubleshooting Tips
- Permission Denied Errors:
- Ensure the user has the correct permissions for their home directory.
- Check that
write_enable=YES
is set in/etc/vsftpd.conf
.
- Connection Refused:
- Verify vsftpd is running with
sudo systemctl status vsftpd
. - Check your firewall settings.
- If you’re getting errors related to
chroot_local_user
, ensure the user’s home directory is not writable by others.
- Verify vsftpd is running with
Chroot Issues:
sudo chmod a-w /home/ftpuser
Final Thoughts
Setting up vsftpd is straightforward and provides a secure way to transfer files. Whether you’re running Ubuntu, Debian, Fedora, or Arch Linux, these steps should get you up and running in no time.
Now you have a reliable FTP server ready to go. If you found this tutorial helpful, feel free to share it!
Happy file transferring! 💾