Linux FTP Configuration
Installing vsftpd
To configure FTP on Ubuntu 22.04, we'll use vsftpd (Very Secure FTP Daemon):
sudo apt update
sudo apt install vsftpd
Configuration File Location
The primary configuration file is located at /etc/vsftpd.conf
. We'll modify this file to customize FTP settings.
Basic Configuration Steps
1. Enable Local Users
sudo nano /etc/vsftpd.conf
Add or modify these key settings:
local_enable=YES
write_enable=YES
chroot_local_user=YES
graph LR
A[FTP Configuration] --> B[Control Port]
A --> C[Data Port Range]
B --> D[Default: 21]
C --> E[Custom High Ports]
Edit port configuration:
## Set custom port range in vsftpd.conf
pasv_min_port=40000
pasv_max_port=50000
User Management
Create FTP User
sudo useradd -m ftpuser
sudo passwd ftpuser
Set FTP User Home Directory
sudo mkdir -p /home/ftpuser/ftp
sudo chown ftpuser:ftpuser /home/ftpuser/ftp
Restart FTP Service
sudo systemctl restart vsftpd
sudo systemctl enable vsftpd
Configuration Options Table
Option |
Description |
Default Value |
local_enable |
Allow local users |
NO |
write_enable |
Enable write permissions |
NO |
pasv_enable |
Enable passive mode |
YES |
pasv_min_port |
Minimum passive port |
Random |
pasv_max_port |
Maximum passive port |
Random |
Firewall Configuration
sudo ufw allow 20/tcp
sudo ufw allow 21/tcp
sudo ufw allow 40000:50000/tcp
By following these steps on LabEx or your local Ubuntu system, you'll have a functional FTP server with customized port configurations.