📁
Networking & Server

FTP Server (vsftpd)

File transfer protocol server for uploading and downloading files

🐧 Linux🍎 Mac🪟 Windows
Reviewed: Tested on: Kubernetes 1.29 · Terraform 1.8 · Ubuntu 22.04

What is this?

FTP lets you upload and download files between your computer and a server.

📥

Step 01

Install FTP Server

(01)Install vsftpd

Linux
1# Ubuntu / Debian
2sudo apt-get install -y vsftpd
3
4# RHEL / Fedora
5sudo dnf install -y vsftpd
6
7sudo systemctl enable vsftpd
8sudo systemctl start vsftpd
⚙️

Step 02

Configure FTP

(01)Basic vsftpd configuration

Linux
1sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
2sudo nano /etc/vsftpd.conf
3
4# Key settings:
5anonymous_enable=NO
6local_enable=YES
7write_enable=YES
8local_umask=022
9chroot_local_user=YES
10allow_writeable_chroot=YES
11pasv_enable=YES
12pasv_min_port=40000
13pasv_max_port=40100
14
15sudo systemctl restart vsftpd
16sudo ufw allow 20,21/tcp
17sudo ufw allow 40000:40100/tcp

(02)FTP over SSL/TLS (FTPS)

Linux
1# In vsftpd.conf:
2ssl_enable=YES
3rsa_cert_file=/etc/ssl/certs/vsftpd.pem
4rsa_private_key_file=/etc/ssl/private/vsftpd.key
5force_local_data_ssl=YES
6force_local_logins_ssl=YES
7
8sudo systemctl restart vsftpd

(03)Create FTP user

Linux
1sudo useradd -m ftpuser
2sudo passwd ftpuser
3sudo usermod -d /home/ftpuser ftpuser
4
5# Connect:
6ftp ftpuser@server-ip
7# Or: lftp ftpuser@server-ip

Step 03

Verify FTP

(01)Test connection

Linux
1sudo systemctl status vsftpd
2ftp localhost
3# Or: curl ftp://ftpuser:pass@localhost/

Step 04

Manage FTP

(01)User management and logs

Linux
1sudo tail -f /var/log/vsftpd.log
2sudo userdel -r ftpuser
3sudo systemctl restart vsftpd