Facilitated secure file transfer operations by configuring and utilizing Vsftpd for client-server file transfers (passive FTP mode)

FTP uses 2 connections:
Command channel – for sending commands.
Data channel – for sending files or directory listings.
Active FTP
Client opens a command connection to the server (port 21).
Client tells the server: “Connect back to me on port X.”
Server opens a new connection to the client's specified port for data.
IN HERE : Server initiates the data connection to the client.
Passive FTP
Client connects to the server on port 21.
Client asks the server to enter passive mode.
Server responds with a random port number (above 1024).
Client connects to that port for data transfer.
IN HERE : Client initiates both command and data connections.
Install and Configure vsftpd (Server Side)
vsftpd
stands for Very Secure FTP Daemon, and it's one of the most secure and efficient FTP servers available.
🧱 Step 1: Install vsftpd
Ubuntu/Debian:
sudo apt update
sudo apt install vsftpd
RHEL/CentOS/Amazon Linux:
sudo yum install vsftpd
Step 2: Configure Passive Mode
Open the config file:
sudo nano /etc/vsftpd.conf
and add these lines
Step 4: Allow Ports in the Firewall
UFW (Ubuntu):
sudo ufw allow 20/tcp
sudo ufw allow 21/tcp
sudo ufw allow 30000:30005/tcp
firewalld (RHEL/CentOS):
sudo firewall-cmd --add-port=21/tcp --permanent
sudo firewall-cmd --add-port=20/tcp --permanent
sudo firewall-cmd --add-port=30000-30005/tcp --permanent
sudo firewall-cmd --reload
Step 5: Restart vsftpd
sudo systemctl restart vsftpd
sudo systemctl enable vsftpd
step 6 : From your local server type
lftp <IP> 21
Subscribe to my newsletter
Read articles from Ashique Antony directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Ashique Antony
Ashique Antony
Passionate DevOps Engineer eager to drive innovation by automating workflows, optimizing cloud infrastructure, and enhancing CI/CD pipelines. Seeking an opportunity to collaborate with forward-thinking teams to streamline development and deployment processes for maximum efficiency and scalability.scalability.