TFTP

The Trivial File Transfer Protocol (TFTP) provides a minimalistic means for transferring files. It is generally used as a part of PXE booting or for updating configuration and firmware on devices which have limited memory such as routers, IP phones and printers.

Server

There are several TFTP server implementations, some of which are listed below.

Note: Make sure not to start different TFTP implementations at the same time. They will fail with an error got more than one socket, because only one may listen to the default TFTP port 69.

tftp-hpa

Install tftp-hpa and then start tftpd.service.

To modify service parameters edit /etc/conf.d/tftpd.

URL rewriting

This server includes a useful URL rewriting feature via the --map-file option (--mapfile in some versions). It allows requests to be altered via regular expressions so the files on the server do not have to match the view the client sees, and different files can be returned to different clients even if they request the same file.

Configure a map by adding --map-file /etc/tftpd.map to /etc/conf.d/tftpd and creating a file such as this:

/etc/tftpd.map
# Add the remote IP address as a folder on the front of all requests.
r ^ \i/

This example file will result in each TFTP request being prefixed with the remote IP address. For example if the machine at 192.168.0.1 requests "boot.bin" and the TFTP server root is /srv/tftp then the file will be returned (or if the server is listening on an IPv6 port).

The available map file options are documented in .

Debugging

The option can be used to turn on all debugging messages. This is very useful for diagnosing why a machine will not successfully boot from the network, as the debug messages list all requests for files, whether rewrite rules were used, where the files were read from on the filesystem and whether the request was successful or not.

It is not possible to log messages to stdout/stderr, as only syslog is supported. This means the messages can be viewed with journalctl or similar.

atftp

Install and then start .

To modify service parameters edit /etc/conf.d/atftpd.

uftpd

is a simple (T)FTP server that can be run from the command line:
# uftpd -n -o ftp=0,tftp=69 /tmp/tftp

The option -o ftp=0 disables the FTP server and only runs TFTP. The server runs in read-only mode by default and passing allows clients to put files on the server. The is redundant in the case of default port, but shows a way to select a different one.

dnsmasq

See dnsmasq#TFTP server.

Client

tftp-hpa

Install tftp-hpa and then tftp your day away!

$ tftp

atftp

The package contains both a server and a client with interactive and batch mode. The client binary is and supports both getting and putting files.

curl

Standard has an ability to connect to a TFTP server and upload a file via:

$ curl -T FILE tftp://HOST

Download a file:

$ curl -o DESTINATION tftp://HOST/file

Where is relative to the TFTP root directory.

gollark: jake: no clue.
gollark: I don't know how this happened.
gollark: Okay, I somehow broke print, this is just another day in potatos.
gollark: Ah, but can you see the potatoS files, jrengen?
gollark: I can't figure out how to edit the help, anyway.
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.