FTP is one of the oldest Internet protocols that is still widely used and is a standard protocol in TCP/IP. FTP is the easiest way to transfer files from one computer to another. On the other hand, one of the file transfer protocols is the Trivial File Transfer Protocol, or TFTP for short, which is widely used in small networks. This protocol is similar to FTP but is lighter, consumes fewer resources, and is more limited than FTP. In this article, we are going to teach you How to Install ftp and tftp Server on Ubuntu 22.04. You can check out the packages offered on the Eldernode website if you would like to purchase an Ubuntu VPS server.
Table of Contents
Tutorial Setup ftp and tftp Server on Ubuntu VPS
Introduction to FTP Server and TFTP Server
One of the most common methods of transferring files between computers is through the FTP (File Transferring Protocol). The use of FTP dates back to before the advent of graphical interfaces for computers, and it was used to connect to a remote computer. Once you’ve connected to the remote computer, you can Send or Receive files on it. A computer that provides files for download via FTP is known as FTP server or FTP host.
TFTP (Trivial File Transfer Protocol) is used to transfer boot files and configure devices such as routers and switches on local networks. TFTP has many limitations compared to FTP, and due to the lack of security measures, it is recommended to use TFTP in internal and private networks and not to use it in any way in public networks.
Features of FTP
–> FTP protocol has the necessary flexibility to be used in different networks according to the type of network protocol.
–> This protocol follows the client-server model, and there is a wide range of FTP clients and servers.
–> This protocol makes it possible for users to use the file system similar to the Unix shell or the Windows command line.
–> Deciding on the type of sending files is at the discretion of the client.
Features of TFTP
–> It is a very light communication methods. This system takes up very low disk space, requires little performance in its user interface, and is very efficient using memory.
–> The TFTP server scans the connected network for contactable devices at startup.
–> One of the security limitations to make the system more secure, is to set the server to accept files or send files only, or you can set it both upload or download.
In the continuation of this article, join us to teach you step by step how to Install FTP and TFTP Server on Ubuntu 22.04.
How to Install FTP Server on Ubuntu 22.04
To install FTP, first update your system repositories by running the following command:
sudo apt get update
Then install vsftpd. Vsftpd is a secure, fast and convenient FTP server for Linux systems. Run the following command to install it:
sudo apt install vsftpd
After installation, run the following command to run vsftpd:
sudo service vsftpd status
You will then see the message:
“The FTP server is running properly.”
How to Configure FTP Server
All VSFTPD configurations are available in the /etc/vsftpd.conf file, so you can easily make a backup of it before changing it, so that we can go back to the original version in case of any problems. Run the following command to backup:
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
Type the comments systematically.
Start by actively listening to the server:
Type Listen = YES
If you do not need IPv6, disable it:
You should not allow access to an anonymous user:
The default setting is that the client can only download the file, so let it stay active:
FTP operates at port 20:
The listening port can be changed:
Press “CTRL+o” to save changes and “CTRL+x” to close the file.
Type the following command to view the file without comment:
sudo cat /etc/vsftpd.conf | grep –v “^#”
Run the following command to create a new user to configure the server:
sudo useradd –m user1
Assign a password and enter it:
sudo passwd user1
Re-enter the password to confirm and update.
This created the user successfully on the FTP server.
How to Access FTP Server
You can now access the FTP server in two ways:
1) Access through Terminal
2) Access through Browser
Start the server configuration by checking your IP address using the following command:
Access to FTP through Terminal
Turn on the terminal and access it with the IP address of the server:
Note: Type your IP address in the corresponding field in the above command.
Access to FTP through Browser
Open the browser and access the FTP server with the following command:
After logging in, enter your username and password; then click OK, the connection will be established:
How to Install TFTP Server on Ubuntu 22.04
First update the APT repository package with the following command:
sudo apt update
To install the tftpd-hpa package, run the following command:
sudo apt install tftpd-hpa
Enter the following command to check the execution of tftpd-hpa service:
sudo systemctl status tftpd-hpa
How to Configure TFTP Server
Run the following command to modify the /etc/default/tftpd-hpa configuration file:
sudo nano /etc/default/tftpd-hpa
Open the configuration file (default TFTP server) for editing.
Here TFTP_USERNAME is set to tftp: TFTP server will run as the user tftp.
TFTP_DIRECTORY is set to /var/lib/tftpboot: You can access it via TFTP.
TFTP_ADDRESS is set to 69: TFTP runs on port 69.
TFTP_OPTIONS is set to -secure: This variable sets TFTP options.
Now change the TFTP_DIRECTORY to / tftp and add the -create option to TFTP_OPTIONS to create or upload files to the TFTP server.
The final configuration file is as follows:
Press “CTRL+x“, then y, then ENTER to save the changes.
Now to create a new /tftp directory, run the following command:
sudo mkdir /tftp
Now enter the following command to change the owner and group of the /tftp folder:
sudo chown tftp:tftp /tftp
Enter the following command to restart the tftpd-hpa service:
sudo systemctl restart tftpd-hpa
Enter the following command to check the performance of the tftpd-hpa service:
sudo systemctl status tftpd-hpa
The tftpd-hpa service is running and configuration has been successful.
In this article, you get acquainted withhow to install ftp and tftp server on ubuntu 22.04 and examined its features. These servers are most common methods to transfer files across a network. Also you learned how to configure and access ftp server and tftp server on Ubuntu 22.04.