Rocky Linux

How to Configure and Run a TFTP Server on Rocky Linux 9

TFTP is the short form of ‘Trivial File Transfer Protocol’ that works as a medium for file transfer without user authentication. It is beneficial for efficient file transfers, network booting, firmware updates, backups, etc. TFTP is the simple version of FTP and works on the UDP or User Datagram Protocol. However, the TFTP server requires correct configuration involving setting up the storage directory and providing access permissions. That’s why many Rocky Linux beginners always need clarification while setting up a TFTP server and get errors. So this article has the complete method to configure and run a TFTP server on Rocky Linux 9.

How to Configure and Run TFTP Server on Rocky Linux 9

First, please update the current system as per the latest updates available in Rocky Linux 9 and then install the TFTP server utility:

sudo dnf update
sudo dnf install tftp-server

 

After installing the TFTP server, you must copy the tftp.service to tftp-server.service and tftp.socket to tftp-server.socket. First, copy tftp.service and tftp-server.service using the cp command:

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

 
Now, copy the tftp.socket to the tftp-server.socket:

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

 

Once you copy the services to the TFTP server, you need to edit the TFTP-server.service in the text editor:

sudo nano /etc/systemd/system/tftp-server.service

 

In the above text, please replace the tftp.socket with the tftp-server.socket and replace the ExecStart as we did below:

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

 
In the above line, the -c option lets the TFTP server create the file, which means the client can upload files to your TFTP server. On the other hand, the -p option lets the TFTP server create the files with the current permission the source file includes.


Once done, please save the file to make the modification successful. After that, you can reload the daemon and enable the TFTP server:

sudo systemctl daemon-reload
sudo systemctl enable --now tftp-server

 

Moreover, you can also check the status of the currently running TFTP-server:

sudo systemctl status tftp-server

 

Now, you can run the following command to enable the read and write permission for TFTP server to upload folders:

sudo chmod 777 /var/lib/tftpboot

 

Finally, allow the traffic from the TFTP server to your terminal through the below command:

sudo firewall-cmd --add-service=tftp –perm
sudo firewall-cmd --reload

 ;

How to Run TFTP Server

Now it is time to run the TFTP server in the terminal, so please run the following command for it:

tftp <server_ip>

 

Please replace the <server_ip> with the IP address of your TFTP server. You can also run the below command to display the TFTP client options:


You can use the above arguments to download, upload and perform various tasks on the TFTP server.

Conclusion

So this is how you can perform TFTP server configuration on Rocky Linux 9. Setting up a TFTP server is simple, but all you need to do is be careful while configuring the server. TFTP may not be highly secured, so make sure you do regular security checkups in the system to make it invulnerable to attacks.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.