After successfully installed and test the TFTP server from the previous article, we are going to configure the TFTP server root directory. So before you continue reading this article, make sure you have read How to Install TFTP Server on Ubuntu 20.04 Server from the previous post and already installed TFTP server successfully.
In this post, we will going to configure the TFTP server to change default root directory. Ubuntu TFTP server, in this case tftpd-hpa default root directory located at /srv/tftp. To change it, we just need edit the configuration file located at /etc/default/tftpd-hpa and change the permission or owner of the new directory.
How to configure tftpd-hpa to change TFTP Server directory?
1. Become root
sudo su
then enter your user password.
2. Edit the configuration file
nano /etc/default/tftpd-hpa
And change the TFTP_DIRECTORY parameter to your new directory, example:
TFTP_DIRECTORY="/home/andra/tftp".
Close and save the configuration file by pressing "CTRL+x" followed by "y" and enter.
Edit the configuration file |
3. Prepare the new directory and change the directory owner
Create new folder if the directory is not exist yet with mkdir, for example:
mkdir /home/andra/tftp
If you are using the existing directory, just skip the step above and change your folder owner using chown tftp:tftp /FOLDER/PATH, for example:
chown tftp:tftp /home/andra/tftp
Prepare the new directory and change the directory owner |
4. Restart TFTP Server service and make sure it is running and active
systemctl restart tftpd-hpa
to restart tftpd-hpa service, and then
systemctl status tftpd-hpa
make sure it is running and active |
The service must be active and running, systemctl status tftpd-hpa will also shows you the error if something is wrong.
This video below will cover all the tutorial on How to Install,configure and troubleshooting TFTP Server on Ubuntu 20.04 Server.