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

Ashique AntonyAshique Antony
2 min read

FTP uses 2 connections:

  1. Command channel – for sending commands.

  2. Data channel – for sending files or directory listings.

Active FTP

  1. Client opens a command connection to the server (port 21).

  2. Client tells the server: “Connect back to me on port X.”

  3. 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

  1. Client connects to the server on port 21.

  2. Client asks the server to enter passive mode.

  3. Server responds with a random port number (above 1024).

  4. 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

1
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.