Skip to content

Setting Up a TFTP Server for Embedded Linux Development

This guide configures a TFTP server on Ubuntu with a dedicated root directory such as /mnt/external/ipc/tftpdir.

Install the server

sudo apt update
sudo apt install tftpd-hpa

Configure tftpd-hpa

Edit the configuration file:

sudo nano /etc/default/tftpd-hpa

Set the service account, root directory, address, and secure mode:

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/mnt/external/ipc/tftpdir"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"

Set directory permissions

The TFTP service needs read and write access to the selected directory:

sudo chown -R tftp:tftp /mnt/external/ipc/tftpdir
sudo chmod -R 777 /mnt/external/ipc/tftpdir

For a production server, prefer the least permissive ownership and mode that still satisfy your upload workflow.

Start the service

sudo systemctl restart tftpd-hpa

Verify the server

  1. Create a test file on the server:
echo "This is a test file" | sudo tee /mnt/external/ipc/tftpdir/testfile.txt
  1. Download it from a client. The client may be the same machine:
tftp localhost
tftp> get testfile.txt
tftp> quit
  1. Check the downloaded content:
cat testfile.txt

Firewall

If UFW is enabled, allow TFTP traffic on UDP port 69:

sudo ufw allow 69/udp