FTP stands for "file transfer protocol", and it allows you to transfer files to a remote computer. The most common FTP server software for Ubuntu is the vsftpd package, which stands for "very secure FTP daemon". It's the default FTP package for Ubuntu, and most other Linux distributions as well.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related FTP queries.
In this context, we shall look into how to install FTP Server on Linux Mint 20.
1. Perform System Update
Before we start with the installation of FTP Server, it's important to make sure your system is up to date by running the following apt commands in the terminal:
$ sudo apt update
2. Install the FTP server on the system
Run the following commands to install the VSFTP server on the Linux Mint 20:
$ sudo apt install vsftpd
1. Configure the VSFTPD configuration file
Once installed successfully, we go ahead to configure VSFTPD. The configuration file is located at /etc/vsftpd.conf:
$ sudo nano /etc/vsftpd.conf
Add or uncomment the following lines if already added:
listen=NO
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
user_sub_token=$USER
pasv_enable=Yes
pasv_min_port=30000
pasv_max_port=30100
allow_writeable_chroot=YES
userlist_enable=YES
userlist_file=/etc/vsftpd.user_list
userlist_deny=NO
ssl_tlsv1=YES
ssl_sslv2=NO
Save and close the file when done then restart vsftpd service:
$ sudo systemctl restart vsftpd.service
2. Secure FTP Server with SSL
Run the following command to generate a self-signed SSL certificate:
$ sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem
Then, open the FTP config file and add SSL path:
$ sudo nano /etc/vsftpd.conf
Add the lines:
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_enable=YES
3. Configure Firewall
To open port 21 (FTP command port), port 20 (FTP data port) and 30000-31000 (Passive ports range), run the following commands:
$ sudo ufw allow 20:21/tcp
$ sudo ufw allow 30000:31000/tcp
Reload the UFW rules by disabling and re-enabling UFW:
$ sudo ufw disable
$ sudo ufw enable
4. Enable and run VSFTPD
Use the following commands to enable and start VSFTPD:
$ sudo systemctl enable vsftpd.service
$ sudo systemctl start vsftpd.service
Confirm vsftpd.service status:
$ sudo systemctl status vsftpd.service
5. Create FTP User
We will now create a new user that we will use to log into FTP. Here, we will create a new user called linuxapt:
$ sudo useradd -m linuxapt
$ sudo passwd linuxapt1
New password:
Retype new password:
passwd: password updated successfully
In order to verify that everything’s working properly, you should store at least one file in linuxapt's home directory.
This file should be visible when we log in to FTP in the next steps:
$ sudo bash -c "echo FTP TESTING > /home/ftpuser/FTP-TEST"
To test the FTP connection, you will need to install an FTP client in the same or a separate system from where you want to access the FTP server.
Here, we are using FileZilla as an FTP client.
This article covers the complete procedure to install and configure the latest version of the FTP Server on the Linux Mint system. In fact, VSFTP (very secure FTP) is a secure FTP protocol which encrypts information transfer between systems.
To Install VSFTPD on Linux Mint 20, Simply Run the following commands to install VSFTP server on Linux Mint 20:
$ sudo apt-get update
$ sudo apt install -y vsftpd