You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

This guide will discuss how to install TFTP Server on CentOS 8 / RHEL 8 Linux machine. The Trivial File Transfer Protocol (TFTP) is a UDP protocol designed to allow users to transfer files between systems. TFTP uses UDP port 69 for data transfer.

The most ideal use case of TFTP protocol is remote booting of diskless devices such as workstations. By setting up TFTP Server on CentOS 8 / RHEL 8 can help you do large installations OS Fedora / CentOS and RHEL server and Desktop installations in your network.

With TFTP, you can only read and write files to or from a remote system, but there is no capability to list files or make any changes on the remote server. It is recommended to run a TFTP Server in your local area network (LAN) as there is no user authentication support. TFTP only provides very little security.

So how then can I install TFTP Server on CentOS 8 / RHEL 8?.

Step 1: Install TFTP Server on RHEL 8 / CentOS 8

The TFTP server and client packages are available on the Base OS repository of RHEL / CentOS 8 Linux. Open your favorite terminal emulator and run the commands below to install TFTP Server on RHEL 8 / CentOS 8.

sudo dnf install -y tftp-server tftp

Step 2: Configure TFTP Server on RHEL 8 / CentOS 8

The installation automatically creates a tftp service and socket file for systemd under /usr/lib/systemd/system. We’ll copy systemd configuration files to /etc/systemd/system directory.

sudo cp /usr/lib/systemd/system/tftp.service /etc/systemd/system/tftp-server.service
sudo cp /usr/lib/systemd/system/tftp.socket /etc/systemd/system/tftp-server.socket

Edit /etc/systemd/system/tftp-server.service service and set these values.

sudo tee /etc/systemd/system/tftp-server.service<<EOF
Description=Tftp Server

ExecStart=/usr/sbin/in.tftpd -c -p -s /var/lib/tftpboot


Meaning of options added to ExecStart line.

  • -c : Allows new files to be created.
  • -p : Used to have no additional permissions checks performed above the normal system-provided access controls.
  • -s : Recommended for security and compatibility with older boot ROMs.

Note that the default location for files uploads and downloads is /var/lib/tftpboot as configured in the service file.

Step 3: Start TFTP Server on RHEL 8 / CentOS 8

We have the configurations for TFTP server done right. Let’s reload the systemd daemon:

sudo systemctl daemon-reload

Once reloaded, start and enable the server:

$ sudo systemctl enable --now tftp-server
Created symlink /etc/systemd/system/ → /etc/systemd/system/tftp-server.service.
Created symlink /etc/systemd/system/ → /etc/systemd/system/tftp-server.socket.

Confirm the service is running.

systemctl status tftp-server

Here is my screenshot.

Set correct permissions for TFTP directory.

sudo chmod 777 /var/lib/tftpboot

For systems with running Firewalld service, allow TFTP ports:

sudo firewall-cmd --add-service=tftp --permanent
sudo firewall-cmd --reload

Add test files to TFTP directory.

sudo touch  /var/lib/tftpboot/file{1..3}.txt
echo "Hello File 1" | sudo tee /var/lib/tftpboot/file1.txt
echo "Hello File 2" | sudo tee /var/lib/tftpboot/file2.txt
echo "Hello File 3" | sudo tee /var/lib/tftpboot/file3.txt

Step 4: Using TFTP Client on CentOS 8 / RHEL 8

Let’s test our connection to TFTP Server using TFTP client. This can be a different machine in your network. But the same machine running TFTP server can be used for this operation

Install the TFTP client:

sudo yum install tftp -y

Try use the the tftp command to connect to the TFTP server.

$ tftp

Here are the commands you can use on the shell.

Commands may be abbreviated.  Commands are:

connect 	connect to remote tftp
mode    	set file transfer mode
put     	send file
get     	receive file
quit    	exit tftp
verbose 	toggle verbose mode
trace   	toggle packet tracing
literal 	toggle literal mode, ignore ':' in file name
status  	show current status
binary  	set mode to octet
ascii   	set mode to netascii
rexmt   	set per-packet transmission timeout
timeout 	set total retransmission timeout
?       	print help information
help    	print help information

Example – Let’s download added files.

$ cat file1.txt file2.txt file3.txt 
Hello File 1
Hello File 2
Hello File 3

To upload a file, use put command.

tftp> put client_test.log

Use quit to quit.

tftp> quit

You’ve learned how to install TFTP Server on CentOS 8 / RHEL 8 Linux system and configure TFTP client to upload and download files from TFTP server. Until next time, stay connected for newer updates.

Also check:

Install and Configure DHCP Server & Client on CentOS 8 / RHEL 8

Enable automatic software updates on CentOS 8 / RHEL 8

How To Install NFS Server on RHEL/CentOS 8

Configure NFS Client CentOS / RHEL 8

Install Zabbix Server RHEL / CentOS 8

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF