How to Install TFTP Server on Ubuntu

Getting Started to Install TFTP Server on Ubuntu

Linux administrators/users use Trivial File Transfer Protocol (TFTP) as a simple and fast way to transfer small files between servers and computers. While TFTP works on a variety of other Linux Server distributions, Install TFTP Server on Ubuntu is what you will learn in this article. When two computer systems on a network need to exchange data, TFTP is a communication method that is necessary. Automated file transfer between machines might be your daily task to do firmware updates and system configurations.

To share files between devices over the network, a TFTP server runs the TFTP protocol. In this way, clients would be allowed to upload or download files to or from the server. As a communication method, TFTP uses very low disk space and needs little performance in its UI. In the end, you will be able to configure networking equipment on your Ubuntu or Debian Linux server to support remote booting of diskless devices or remote loading of your current operating system.

Differences between FTP and TFTP help for better understanding this guide. TFTP uses UDP over IP port 69 which is a simplified version of FTP. Since TFTP does not support framing, you might find it a bit slower than FTP. So, to not increase the efficiency, it is mostly used in local area networks for transferring boot files and configuring devices purposes, such as switches and routers.

Although installing and running a TFTP server on Ubuntu requires basic Linux knowledge, this guide will help you understand what you need to do. Join us to review all the required steps to Install TFTP Server on Ubuntu.

Prerequisites to Install TFTP Server on Ubuntu 20.04 & Ubuntu 22.04

To Install TFTP on Ubuntu, your machine needs to meet all the below specifications:

Quick Guide to Install TFTP Server on Ubuntu

Now that you learned What is TFTP Server and What is TFTP used for, let’s go through the steps of this tutorial and learn How to Install TFTP on Ubuntu.

Step 1. Update Package Lists

As always, we start the installation process by updating the system and package lists and letting users have the latest package information available. Run the command below to update package lists and go for installing new software on your Ubuntu server.

$ sudo apt update

Step 2. Install TFTP Server Ubuntu

Now, you are ready to use the following command and install the TFTP server package on the Ubuntu system.

$ sudo apt install tftpd-hpa

Step 3. Configure Ubuntu TFTP Server

When you are finished installing TFTP Server on Ubuntu, it is time to configure it. To do this, use your preferred text editor to open the tftpd-hpa file in the command below:

$ sudo nano /etc/default/tftpd-hpa

Once the configuration file is opened in your text editor, change the TFTP server IP address to 0.0.0.69 and the server directory to “/var/lib/tftpboot” to enable connections from any IP address:

TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"

When you are done, save and close the configuration file.

Step 4. Create a TFTP Server Directory

The configuration is completed if the TFTP server is pointing to the directory where the files that clients request are stored. Run the following command to create the TFTP server directory:

$ sudo mkdir /var/lib/tftpboot

Step 5. Change the TFTP Server Directory’s Permissions

Set the tftpboot directory’s permissions to 777 after making the TFTP server directory. It guards against illegal access to or alteration of server files and guarantees the security and integrity of the system.

To accomplish this, run the following commands:

$ sudo chmod -R 777 /var/lib/tftpboot
$ sudo chown -R nobody:nogroup /var/lib/tftpboot

chmod command or chown command in linux enable anyone to read, write, and execute files in the tftpboot directory by setting the directory’s permissions. Additionally, they assigned the nobody user and nogroup ownership of the directory.

Step 6. Restart TFTP Server

You are so close to finishing the whole process and Installing ubuntu TFTP Server. If you passed all the above steps successfully, run the command below to apply all changes by restarting the TFTP server:

$ sudo systemctl restart tftpd-hpa

So, the TFTP server service must have been restarted on your Linux Ubuntu system.

How to Run TFTP Server on Ubuntu

As you reviewed, all the simple and fast above steps were required to Install TFTP Server on Ubuntu. After a successful installation, let’s see how to run it through the below steps:

Step 1. Verify TFTP Server Services

To check the Services of the TFTP Server, type:

$ sudo systemctl status tftpd-hpa

Once the ”active (running)” status is displayed in the output, you can make sure of a correct TFTP Server installation and configuration on the Ubuntu system.

But if the TFTP server services are not in an active state, run the following command to start them:

$ sudo systemctl start tftpd-hpa

Step 2. Enable the TFTP Server on Ubuntu

You can let the TFTP Server start automatically at boot time. To do this, you need to use the command below and enable the TFTP Server:

$ sudo systemctl enable tftpd-hpa

Step 3. Test the TFTP Server on Ubuntu

You can test the TFTP server to check if it is working or not. To do this, run the command below and replace your actual IP address:

$ tftp Your IP address

Once you view your IP address in the output, it means that the TFTP server has been successfully connected.

How to Use Ubuntu TFTP Server

When you Install TFTP Server on Ubuntu and do a successful Configuration, you are ready to Use the TFTP Server on Ubuntu. You can use a TFTP Server to transfer a file. This will be done from the Server to the Local Machine and verse versa.

  • Transfer a File From Server to Local Machine

As we mentioned, you can use a TFTP Server on Ubuntu to transfer your considered file from a Server to a local machine. To do this, simply run the command below by specifying the filename as ”file.txt”:

> get file.txt
  • Transfer a File From Local Machine to Server

Let us examine the process of accomplishing the aforementioned task in reverse and transferring your preferred file from a local machine to the server. By specifying the ”file.txt” that is present in the home directory, use the following command to do this:

> put file.txt

How to Uninstall TFTP Server on Ubuntu

For any reason, if you decide to remove the TFTP Server from Ubuntu, you can do it. Run the command below to uninstall only the tftp package:

sudo apt-get remove tftp

And if you prefer to uninstall tftp and its dependencies, type:

sudo apt-get -y autoremove tftp

Also, you can remove ftp configuration, data, and all of its dependencies. To do this, use the command below:

sudo apt-get -y autoremove --purge tftp

Conclusion

In this article, you learned How to Install TFTP Server on Ubuntu. Now you know also how to Configure, Test, and Use a TFTP Server. Anyway, the way to uninstall TFTP Server is explained in this guide to help you stop using it anytime you prefer. Keep in mind that you should only use TFTP on reliable networks because it is an intrinsically unsafe protocol. Otherwise, you can use SCP or SFTP instead for secure file transfers.

If you follow the above steps properly, you can smoothly install TFTP Server on Ubuntu and Debian without any errors but do not hesitate to contact us if you encounter any problems. Our technical support team will try their best to solve your problems.

Leave a Reply

Your email address will not be published. Required fields are marked.