On Ubuntu Server, there are quite a few ways users can host a Trivial File Transfer Protocol system to allow users to send files back and forth. However, probably the most accessible tool for setting up set up a TFTP server on Ubuntu Server is the Tftpd software. Why? It’s very easy to load up on all modern Ubuntu releases. Better yet, all of the configuration options are very straightforward and easy to understand even if you’re new to Linux.
In this guide, we’ll walk you through the process of hosting a TFTP server on Ubuntu server. Ideally, the software should run from Ubuntu Server. That said, it is possible to set all of this software up to run on Ubuntu Desktop just fine.
Note: we focus heavily on Ubuntu Linux in this tutorial, as the majority of Linux server users are using it, and it would be confusing to cover multiple server operating systems. TFTP works on a variety of other Linux Server distributions.
Install TFTP server software and related packages
Setting up a TFTP server on Ubuntu starts by installing all of the relevant packages that it needs to operate correctly. These packages are installable via the Apt package manager from the command-line.
To get it started on your Ubuntu Server or Desktop machine, launch a terminal window by pressing Ctrl + Alt + T or Ctrl + Shift + T on the keyboard. Then, enter the commands below.
Note: using Debian Linux? The guide and setup process for Tftpd on it is identical to Ubuntu Linux. To get it working, follow along with this guide but replace all instances of Apt with Apt-get.
sudo apt install xinetd tftpd tftp
If you’re on Ubuntu Desktop, it’s also possible to launch Ubuntu Software Center, search for each of these packages and install that way, if you’re not a fan of installing programs with Apt.
Now that the TFTPD packages are set up on Ubuntu Server (or Desktop) the next step is to configure the server so that it runs correctly. The first step in the configuration process is to create a folder in the /etc/ directory.
sudo mkdir -p /etc/xinetd.d/
With the folder taken care of, create a new text file with the touch command. All of the server configurations will go in this file.
sudo touch /etc/xinetd.d/tftp
Can’t use sudo touch? Try elevating the terminal shell to Root with sudo -s beforehand.
sudo -s touch /etc/xinetd.d/tftp
Now that the file exists in /etc/xinetd.d/, open up it up in the Nano text editor.
sudo nano -w /etc/xinetd.d/tftp
Take the code below and paste it into the Nano text editor window.
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /tftpboot
disable = no
Save the edit to the tftp file in Nano by pressing the Ctrl + O keyboard combination. Then, press Ctrl + X to exit.
Following the TFTP configuration file, you must create the “tftpboot” folder in the Root directory (/) on your Ubuntu Server or Ubuntu Desktop.
Using the mkdir command, create the directory.
sudo mkdir /tftpboot
Next, update the permissions of the “tftpboot” folder using the chmod command.
sudo chmod -R 777 /tftpboot
Once you’ve updated the permission information for the “tftpboot” directory, it’s time to use the chown tool to change the user permission information.
Note: we’re using “nobody” in the chown command below for a reason. It’ll allow access to everyone who attempts to access TFTP the same permissions, rather than setting it for individual users.
sudo chown -R nobody /tftpboot
Lastly, you must restart the TFTP server software to accept the changes. On Ubuntu 16.04 and newer, this is done with the systemctl command.
sudo systemctl restart xinetd.service
Assuming the above systemctl command is successful, the server should be up and running. Move to the next section to learn how to transfer files with TFTP.
Transfer files over TFTP
Now that the TFTP server on Ubuntu server is up and running, we can talk about how to upload and download files. The reason going over how to use TFTP on Linux is necessary, is that FTP clients like FileZilla and others likely do not have support for it.
To start, open up a terminal on the computer you plan to connect to the remote TFTP server on. Then install the “tftp” package, so that you may send out connections, upload, download, etc.
sudo apt install tftp
sudo apt-get install tftp
sudo pacman -S atftp
sudo dnf install tftp
sudo zypper install tftp
With the app set up on your system, find out the IP address of your Ubuntu TFTP server. Then, connect out to the server, by following the example below.
Note: need help figuring out the IP address for your TFTP server? Check out this post here!
To send a file to your TFTP server, use the put command.
To download a file from your TFTP server, use the get command.