Introduction
An FTP server allows you to transfer files between computers over a network. vsftpd (Very Secure FTP Daemon) is a popular FTP server for Unix-like systems. This tutorial will guide you through installing and configuring vsftpd on a Linux server.
Prerequisites
- A Linux server (e.g., Ubuntu or Debian).
- Access with sudo privileges.
Step 1: Install vsftpd
Update the package list and install vsftpd:
sudo apt update sudo apt install vsftpd -y
Step 2: Backup the Configuration File
Before making changes, back up the original configuration file:
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
Step 3: Configure vsftpd
Edit the vsftpd configuration file:
sudo nano /etc/vsftpd.conf
Modify the following settings:
- Uncomment local_enable=YES to allow local users to log in.
- Uncomment write_enable=YES to allow write permissions.
- Uncomment chroot_local_user=YES to confine users to their home directories.
Add the following line to enable passive mode (adjust the port range as needed):
pasv_min_port=40000 pasv_max_port=50000
Step 4: Restart vsftpd Service
Apply the changes by restarting the vsftpd service:
sudo systemctl restart vsftpd
Step 5: Create an FTP User
Create a new user for FTP access:
sudo adduser ftpuser
Set a password when prompted.
Step 6: Adjust Firewall Settings
Allow FTP traffic through the firewall:
sudo ufw allow 20/tcp sudo ufw allow 21/tcp sudo ufw allow 40000:50000/tcp
Step 7: Test the FTP Connection
Use an FTP client like FileZilla or the command line to connect:
ftp your_server_ip
Log in with the ftpuser credentials.
Step 8: Secure the FTP Server (Optional)
For enhanced security, consider:
- Using FTPS: Configure SSL/TLS encryption.
- Limiting User Access: Restrict users to specific directories.
- Disabling Anonymous Access: Ensure anonymous_enable=NO is set.
Conclusion
You have installed and configured an FTP server using vsftpd. Users can now transfer files securely to and from your server.