Install and Configure TFTP Server on Ubuntu 20.04

 Trivial File Transfer Protocol (TFTP) is a simple file transfer protocol that is often used for firmware update of network devices, system installation and transfer of configuration files. Installing and configuring a TFTP server is a relatively simple process in the Ubuntu 20.04 operating system. This article will provide detailed step-by-step instructions to help you successfully install and configure a TFTP server on Ubuntu 20.04.

Step 1: Install the TFTP server package To start installing the TFTP server, execute the following command in Terminal to ensure that the system package list is up to date and install the tftpd-hpa package:

sudo apt update sudo apt install tftpd-hpa

Step 2: Configure the TFTP server After the installation is complete, we need to do some configuration on the TFTP server. Open the TFTP configuration file /etc/default/tftpd-hpa:

sudo vim /etc/default/tftpd-hpa

In the opened file you can see some configurable parameters. Make sure the following lines are not commented out (i.e. do not #start with ):

TFTP_USERNAME="tftp" TFTP_DIRECTORY="/var/lib/tftpboot" TFTP_ADDRESS="0.0.0.0:69" TFTP_OPTIONS="--secure"

These parameters are used to specify the user name of the TFTP server, TFTP file storage directory, listening address and other options. Make sure /var/lib/tftpbootthe directory exists, if not, you can create it with the following command:

sudo mkdir /var/lib/tftpboot sudo chmod -R 777 /var/lib/tftpboot

The above command will create /var/lib/tftpbootthe directory and set the appropriate permissions.

Step 3: Restart the TFTP server After saving and closing the configuration file, use the following command to restart the TFTP server to make the new configuration take effect:

sudo systemctl restart tftpd-hpa

The TFTP server will restart and use the new configuration.

Step 4: Verify TFTP Server To verify that the TFTP server is working properly, you can use the tftp command for file transfers. For example, trying to download a file from a TFTP server:

tftp 127.0.0.1 tftp> get filename

Please filenamereplace with the file name that exists on your TFTP server. If the file downloads successfully, then the TFTP server is properly configured and functional.

Guess you like

Origin blog.csdn.net/weixin_53000184/article/details/130805401