Manjaro Linux

How to install and configure TFTP server on Manjaro

TFTP (an acronym of Trivial File Transport Protocol)  is a file transfer protocol that allows Linux to boot over the network. TFTP is designed for transferring small files. Moreover, it works on top of the UDP and is extremely simple (hence trivial) to implement and use.

TFTP is usually used in Linux installations where NFS is not available or unsuitable, but it can also be used as a last resort when HTTP servers are unreachable, or due to some firewall restrictions. Interestingly, TFTP is quite useful to restore Linux images to routers and switches, but many just use it for Linux installations.

Following the importance of TFTP, we have prepared this guide to demonstrate the installation and configuration of TFTP server on Manjaro Linux.

How to install TFTP server on Manjaro Linux

The tftp server can be installed on Manjaro using a command line and graphical support. We have exercised both methods to get the tftp server.

  • Installing TFTP server using command line
  • Installing TFTP server using a graphical interface

How to install TFTP server on Manjaro using command line

The official support of TFTP is provided by the tftp-hpa package available on the official repository of Manjaro Linux. To download any package from the official repository of Manjaro, update the packages by issuing the following command.

$ sudo pacman -Syu

Now, you can install tftp-hpa on Manjaro using pacman manager and the command to do so, is provided here.

$ sudo pacman -S tftp-hpa

How to install TFTP server on Manjaro using graphical interface

The following steps must be carried out to install a TFTP server on Manjaro Linux.

Step 1 : Open the “Show Application” menu and navigate to “Add/Remove Software” on Manjaro.

Step 2 : Navigate to search and look for tftp-hpa in several repositories of Manjaro. As the search result appears, click on the tftp-hpa to get to the installation phase.

The following window contains an Install button; click on it to start the installation process:

After clicking the Install button, and Apply button will be enabled. Navigate to that Apply button for further proceedings.

After that, an authentication prompt will appear where you have to enter your password to continue:

The next window displays the packages to be installed. To move forward, click on Apply:

The installation will take hardly a minute to complete:

How to configure TFTP server on Manjaro Linux

After installation of tftp-hpa, the first step is to enable the tftpd service by issuing the following command. The tftpd service is responsible for managing the tftp server.

$ sudo systemctl enable tftpd

Start the tftp service by issuing the below-mentioned command in Manjaro terminal.

$ sudo systemctl start tftpd

After that, check the status of service with the help of the following command.

$ sudo systemctl status tftpd

Modify Service Parameters : The service parameters handle several services over the tftp server, and they can be configured by accessing the file named “/etc/conf.d/tftpd“. To edit the file, open it in any editor. For instance, the below-mentioned command opens the file using nano editor.

$ sudo nano /etc/conf.d/tftpd

The file contains the set of predefined parameters, and the user defined parameters can be set in the following format:

TFTP_=

Let’s say we want to set a new parameter that would allow you to create new files. By default, you can only upload existing files using tftpd.

To do so, set the OPTIONS property to secure and create by following the syntax.

TFTP_OPTIONS="--secure --create"

Note : The TFTPD_ARGS= “–secure –create” automatically sets all the parameters. If you have this line in your configuration file, you do not need to declare any service parameter.

To allow tftp to adapt changes, restart the tftpd service:

$ sudo systemctl restart tftpd

How to connect tftp server on Manjaro Linux

After successful installation, the following command will connect to the tftp server.

Note : In your case, the IP address may be changed.

$ tftp 192.168.168.8.104

After connecting to the tftp server, get the status with the help of the status keyword.

status

You can disconnect from the tftp server at any time by using “q” or “quit” keywords.

How to use tftp to retrieve files in Manjaro

The tftp stores and retrieves files from the directory named “/srv/tftp“, thus it is mandatory that files must be present in the “/srv/tftp” directory.

Create a file in “/srv/tftp” directory : Firstly, use the touch command to create a file in “/srv/tftp” directory; we have created “linuxhint.txt” file:

$ sudo touch linuxhint.txt /srv/tftp

Now, use the ls command to ensure the presence of the “linuxhint.txt” file in a directory named “/srv/tftp”:

$ ls /srv/tftp

Downloading a file from the tftp server : To download a file from the tftp server, you have to use the get keyword with the file name. The command provided below will download a file linuxhint.txt from the tftp server. In our case, the command provided below downloads the linuxhint.txt file from “/srv/tftp” and will store it in the home directory(by default).

$ get linuxhint.txt

Conclusion

TFTP server enables the users to send or receive files over a network. This writeup explains the installation of the tftp server on Manjaro Linux. Alongside the installation, a brief configuration is also provided. We have provided the steps to update the service parameters necessary for transferring files using the tftp server. In the recent support of the tftp server, the service parameters are already declared in the configuration directory. However, being a Linux user, you must know these configuration-related parameters in tftp.

About the author

Adnan Shabbir