TFTPD(8)
โจ tftpd(8) โ Trivial File Transfer Protocol server โจ
okay bestie, welcome to the System Manager's Manual entry for tftpd(8) โ yes, the Trivial File Transfer Protocol server. this page is a whole journey: flags, RFC 2347 negotiation, filename remapping, and a security section that is lowkey very serious. let's get into it ๐
๐ NAME ๐
tftpd โ Trivial File Transfer Protocol server.
๐ธ SYNOPSIS ๐ธ
here's the whole shape of it, bestie:
in.tftpd [options...] directory...
๐ DESCRIPTION ๐
okay so tftpd is a server for the Trivial File Transfer Protocol. the TFTP protocol is extensively used to support remote booting of diskless devices. the server is normally started by inetd, but it can also run standalone. periodt.
๐ OPTIONS ๐
okay bestie, this is the big one โ every flag, every default, no skipping. ๐
--ipv4,-4โ connect with IPv4 only, even if IPv6 support was compiled in.--ipv6,-6โ connect with IPv6 only, if it was compiled in.-l,--listenโ run the server in standalone (listen) mode instead of running frominetd. in listen mode, the--timeoutoption is ignored, and the--addressoption can be used to specify a specific local address or port to listen to.--foreground,-Lโ like--listen, but do not detach from the foreground process. implies--listen.--address[address][:port],-a[address][:port]โ specify a specific address and port to listen to when called with the--listenor--foregroundoption. the default is to listen to the tftp port specified in/etc/serviceson all local addresses. please note: numeric IPv6 addresses must be enclosed in square brackets to avoid ambiguity with the optional port information.--create,-cโ allow new files to be created. by default,tftpdwill only allow upload of files that already exist. files are created with default permissions allowing anyone to read or write them, unless the--permissiveor--umaskoptions are specified.--secure,-sโ change root directory on startup. this means the remote host does not need to pass along the directory as part of the transfer, and may add security. when--secureis specified, exactly one directory should be specified on the command line. the use of this option is recommended for security as well as compatibility with some boot ROMs which cannot be easily made to include a directory name in its request.--userusername,-uusername โ specify the username whichtftpdwill run as; the default is"nobody". the user ID, group ID, and (if possible on the platform) the supplementary group IDs will be set to the ones specified in the system permission database for this username.--umaskumask,-Uumask โ sets the umask for newly created files to the specified value. the default is zero (anyone can read or write) if the--permissiveoption is not specified, or inherited from the invoking process if--permissiveis specified.--permissive,-pโ perform no additional permissions checks above the normal system-provided access controls for the user specified via the--useroption.--pidfilepidfile,-Ppidfile โ when run in standalone mode, write the process ID of the listening server into pidfile. on normal termination (SIGTERMorSIGINT) the pid file is automatically removed.--timeouttimeout,-ttimeout โ when run frominetd, this specifies how long, in seconds, to wait for a second connection before terminating the server.inetdwill then respawn the server when another request comes in. the default is900(15 minutes.)--retransmittimeout,-Ttimeout โ determine the default timeout, in microseconds, before the first packet is retransmitted. this can be modified by the client if thetimeoutorutimeoutoption is negotiated. the default is1000000(1 second.)--mapfileremap-file,-mremap-file โ specify the use of filename remapping. the remap-file is a file containing the remapping rules. see the section on filename remapping below. this option may not be compiled in, see the output ofin.tftpd -Vto verify whether or not it is available.--verbose,-vโ increase the logging verbosity oftftpd. this flag can be specified multiple times for even higher verbosity.--verbosityvalue โ set the verbosity value to value.--refusetftp-option,-rtftp-option โ indicate that a specific RFC 2347 TFTP option should never be accepted.--blocksizemax-block-size,-Bmax-block-size โ specifies the maximum permitted block size. the permitted range for this parameter is from512to65464. some embedded clients request large block sizes and yet do not handle fragmented packets correctly; for these clients, it is recommended to set this value to the smallest MTU on your network minus 32 bytes (20 bytes for IP, 8 for UDP, and 4 for TFTP; less if you use IP options on your network.) for example, on a standard Ethernet (MTU 1500) a value of1468is reasonable.--port-rangeport:port,-Rport:portโ force the server port number (the Transaction ID) to be in the specified range of port numbers.--version,-Vโ print the version number and configuration to standard output, then exit gracefully.
๐ฆ RFC 2347 OPTION NEGOTIATION ๐ฆ
this version of tftpd supports RFC 2347 option negotiation. currently implemented options are:
blksize(RFC 2348) โ set the transfer block size to anything less than or equal to the specified option. this version oftftpdcan support any block size up to the theoretical maximum of65464bytes.blksize2(nonstandard) โ set the transfer block size to anything less than or equal to the specified option, but restrict the possible responses to powers of 2. the maximum is32768bytes (the largest power of 2 less than or equal to65464.)tsize(RFC 2349) โ report the size of the file that is about to be transferred. this version oftftpdonly supports thetsizeoption for binary (octet) mode transfers.timeout(RFC 2349) โ set the time before the server retransmits a packet, in seconds.utimeout(nonstandard) โ set the time before the server retransmits a packet, in microseconds.rollover(nonstandard) โ set the block number to resume at after a block number rollover. the default and recommended value is zero.
the --refuse option can be used to disable specific options; this may be necessary to work around bugs in specific TFTP client implementations. for example, some TFTP clients have been found to request the blksize option, but crash with an error if they actually get the option accepted by the server.
๐ FILENAME REMAPPING ๐
okay so the --mapfile option specifies a file which contains filename remapping rules. each non-comment line (comments begin with hash marks, #) contains an operation, specified below; a regex, a regular expression in the style of egrep; and optionally a replacement pattern. the operation indicated by operation is performed if the regex matches all or part of the filename. rules are processed from the top down, and by default, all rules are processed even if there is a match.
the operation can be any combination of the following letters:
rโ replace the substring matched by regex by the replacement pattern. the replacement pattern may contain escape sequences; see below.gโ repeat this rule until it no longer matches. this is always used withr.iโ match the regex case-insensitively. by default it is case sensitive.eโ if this rule matches, end rule processing after executing the rule.sโ if this rule matches, start rule processing over from the very first rule after executing this rule.aโ if this rule matches, refuse the request and send an access denied error to the client.Gโ this rule applies to GET (RRQ) requests only.Pโ this rule applies to PUT (WRQ) requests only.~โ inverse the sense of this rule, i.e. execute the operation only if the regex doesn't match. can't be used together withr.
the following escape sequences are recognized as part of the replacement pattern:
\0โ the entire string matched by the regex.\1to\9โ the strings matched by each of the first nine parenthesized subexpressions,\( ... \), of the regex pattern.\iโ the IP address of the requesting host, in dotted-quad notation (e.g.192.0.2.169).\xโ the IP address of the requesting host, in hexadecimal notation (e.g.C00002A9).\\โ literal backslash.\whitespaceโ literal whitespace.\#โ literal hash mark.\Uโ turns all subsequent letters to upper case.\Lโ turns all subsequent letters to lower case.\Eโ cancels the effect of\Uor\L.
if the mapping file is changed, you need to send SIGHUP to any outstanding tftpd process.
๐ฅ SECURITY ๐ฅ
bestie, the security section is the main character here โ do not skip it. ๐จ
okay bestie, this part is not a joke. the use of TFTP services does not require an account or password on the server system. due to the lack of authentication information, tftpd will allow only publicly readable files (o+r) to be accessed, unless the --permissive option is specified. files may be written only if they already exist and are publicly writable, unless the --create option is specified. note that this extends the concept of public to include all users on all hosts that can be reached through the network; this may not be appropriate on all systems, and its implications should be considered before enabling TFTP service. typically, some kind of firewall or packet-filter solution should be employed. if appropriately compiled (see the output of in.tftpd --version) tftpd will query the hosts_access(5) database for access control information. this may be slow; sites requiring maximum performance may want to compile without this option and rely on firewalling or kernel-based packet filters instead.
the server should be set to run as the user with the lowest possible privilege; please see the --user flag. it is probably a good idea to set up a specific user account for tftpd, rather than letting it run as "nobody", to guard against privilege leaks between applications.
access to files can, and should, be restricted by invoking tftpd with a list of directories by including pathnames as server program arguments on the command line. in this case access is restricted to files whose names are prefixed by one of the given directories. if possible, it is recommended that the --secure flag is used to set up a chroot() environment for the server to run in once a connection has been set up.
finally, the filename remapping (--mapfile flag) support can be used to provide a limited amount of additional access control.
๐ CONFORMING TO ๐
okay so this tftpd is out here conforming to the standards, and honestly? iconic behavior. Hereโs the certified vibe check:
RFC 1123, Requirements for Internet Hosts - Application and Support.RFC 1350, The TFTP Protocol (revision 2).RFC 2347, TFTP Option Extension.RFC 2348, TFTP Blocksize Option.RFC 2349, TFTP Timeout Interval and Transfer Size Options.
๐ AUTHOR ๐
This version of tftpd is maintained by H. Peter Anvin at <hpa@zytor.com>. ๐
It was derived from, but has substantially diverged from, an OpenBSD source base, with added patches by Markus Gutschke and Gero Kulhman. no cap, thatโs the whole author lore.
๐ฆ SEE ALSO ๐ฆ
go read these too, bestie:
๐ mwah, bestie โ this page is tftp-hpa 5.2, dated 14 September 2009, and itโs TFTPD(8) signing off ๐
๐ฆ where this page comes from
- alpine 3.22: tftp-hpa-doc 5.2-r7 ยท BSD-4-Clause
- alpine 3.23: tftp-hpa-doc 5.2-r7 ยท BSD-4-Clause
- alpine 3.24: tftp-hpa-doc 5.2-r7 ยท BSD-4-Clause
- arch rolling: tftp-hpa 5.2-11 ยท BSD-4-Clause-UC
- opensuse-leap 16.0: tftp 5.2-160000.2.2 ยท BSD-3-Clause
- opensuse-leap 16.0: tftp 5.2-160000.2.2 ยท BSD-3-Clause
- opensuse-leap 16.0: tftp 5.2-160000.2.2 ยท BSD-3-Clause
- opensuse-leap 16.0: tftp 5.2-160000.2.2 ยท BSD-3-Clause
- Copyright (c) 1990, 1993, 1994 The Regents of the University of California. All rights reserved
- Copyright 2001-2009 H. Peter Anvin - All Rights Reserved
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms