FTP, known as File Transfer Protocol, is built on Client & Server network architecture. It is a standard protocol that is commonly used for communication purposes. It transfers the files from the server computer to the client over the network. FTP has individual control and connections.
All modern operating systems have a default command line prompt that creates the FTP connection. The main purpose of this write-up is to demonstrate the method of installation and configuration of the FTP server on Ubuntu 22.04. The outline of this guide is provided below:
Let’s install the FTP server first:
Installation of FTP Server on Ubuntu 22.04
FTP server can be installed on Ubuntu 22.04 through the Command-Line-Interface (terminal). For this purpose, follow the provided step-by-step process:
Step 1: Update System Packages
To update the system packages list, run the following command:
$ sudo apt update
It can be seen that all the packages are up to date.
Step 2: Install vsftpd (FTP Server)
For Ubuntu 22.04, vsftpd is an FTP server that is available on the default repository of Ubuntu 22.04. To install the FTP (vsftpd) server, run the following command:
$ sudo apt install vsftpd
The FTP (vsftpd) is installed successfully on Ubuntu 22.04.
Step 3: Check Status
To check the status of an FTP (vsftpd) service, run the following command:
$ sudo service vsftpd status
It can be seen that FTP (vsftpd) is in a running (active) state.
Configuration of the FTP server on Ubuntu 22.04
The following steps are carried out for the basic configuration of the FTP server on Ubuntu 22.04.
Step 1: Configure FTP Server
It is to be noted that all of the configurations related to the FTP server are stored in a file named “sudo nano /etc/vsftpd.conf”. To configure an FTP server on Ubuntu 22.04, run the following command:
$ sudo nano /etc/vsftpd.conf
And add the following code:
listen=NO listen ipv6=YES 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 rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key ssl_enable=NO pasv_enable=Yes pasv_min_port=10000 pasv_max_port=10100 allow_writeable_chroot=YES
It enables the port to listen to IPv6 and local ports. However, it does not enable anonymous traffic.
Step 2: Configure Firewall
The FTP server listens to “Port#20”. Run the below-mentioned command to configure the traffic rules over the firewall:
$ sudo ufw allow from any to any port 20,21,10000:10100 proto tcp
It can be seen that the rule is added successfully. It allows the traffic coming from any port to 20,21,10000:10100.
Step 3: Restart the FTP Service
After configuring the firewall, restart the FTP service using the following command:
$ sudo systemctl restart vsftpd
The FTP (vsftpd) has been restarted.
Removing the FTP Server from Ubuntu 22.04
If you have installed the FTP server on Ubuntu using the terminal, you can remove it with the help of the following command:
$ sudo apt remove vsftpd
The FTP server was successfully removed/uninstalled from Ubuntu 22.04.
Congratulations! You have successfully learned how to install an FTP server on Ubuntu 22.04.
An FTP server can be installed on Ubuntu 22.04 using the “sudo apt install vsftpd”. FTP is a client-server network protocol that is used for communication purposes. This descriptive write-up has illustrated a step-by-step process to install and configure an FTP server on Ubuntu 22.04.
The Best Linux Tutorials Website