1ea022d16SRodney W. Grimes.\" Copyright (c) 1983, 1991, 1993 2ea022d16SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 3ea022d16SRodney W. Grimes.\" 4ea022d16SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 5ea022d16SRodney W. Grimes.\" modification, are permitted provided that the following conditions 6ea022d16SRodney W. Grimes.\" are met: 7ea022d16SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 8ea022d16SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 9ea022d16SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 10ea022d16SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 11ea022d16SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 12ea022d16SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software 13ea022d16SRodney W. Grimes.\" must display the following acknowledgement: 14ea022d16SRodney W. Grimes.\" This product includes software developed by the University of 15ea022d16SRodney W. Grimes.\" California, Berkeley and its contributors. 16ea022d16SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors 17ea022d16SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 18ea022d16SRodney W. Grimes.\" without specific prior written permission. 19ea022d16SRodney W. Grimes.\" 20ea022d16SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21ea022d16SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22ea022d16SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23ea022d16SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24ea022d16SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25ea022d16SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26ea022d16SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27ea022d16SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28ea022d16SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29ea022d16SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30ea022d16SRodney W. Grimes.\" SUCH DAMAGE. 31ea022d16SRodney W. Grimes.\" 32ea022d16SRodney W. Grimes.\" @(#)tftpd.8 8.1 (Berkeley) 6/4/93 33229494cbSMike Pritchard.\" $FreeBSD$ 34ea022d16SRodney W. Grimes.\" 35a1aea88aSCraig Rodrigues.Dd June 22, 2011 36ea022d16SRodney W. Grimes.Dt TFTPD 8 370efe23d6SRuslan Ermilov.Os 38ea022d16SRodney W. Grimes.Sh NAME 39ea022d16SRodney W. Grimes.Nm tftpd 40eb083802SRuslan Ermilov.Nd Internet Trivial File Transfer Protocol server 41ea022d16SRodney W. Grimes.Sh SYNOPSIS 42ff7e281dSYaroslav Tykhiy.Nm tftpd 435276e639SWarner Losh.Op Fl cdClnow 44dba0fd30SEdwin Groothuis.Op Fl F Ar strftime-format 458ea31785SWarner Losh.Op Fl s Ar directory 46f62eaadfSGarrett Wollman.Op Fl u Ar user 47eff77877SMatthew N. Dodd.Op Fl U Ar umask 48ea022d16SRodney W. Grimes.Op Ar directory ... 49ea022d16SRodney W. Grimes.Sh DESCRIPTION 503f162cb8SPhilippe CharnierThe 513f162cb8SPhilippe Charnier.Nm 523f162cb8SPhilippe Charnierutility is a server which supports the 53ea022d16SRodney W. GrimesInternet Trivial File Transfer 54f62eaadfSGarrett WollmanProtocol 55f62eaadfSGarrett Wollman.Pq Tn RFC 1350 . 56ea022d16SRodney W. GrimesThe 57ea022d16SRodney W. Grimes.Tn TFTP 58ea022d16SRodney W. Grimesserver operates 59ea022d16SRodney W. Grimesat the port indicated in the 60ea022d16SRodney W. Grimes.Ql tftp 61ea022d16SRodney W. Grimesservice description; 62ea022d16SRodney W. Grimessee 63ea022d16SRodney W. Grimes.Xr services 5 . 64ea022d16SRodney W. GrimesThe server is normally started by 65ea022d16SRodney W. Grimes.Xr inetd 8 . 66ea022d16SRodney W. Grimes.Pp 67ea022d16SRodney W. GrimesThe use of 68ea022d16SRodney W. Grimes.Xr tftp 1 69ea022d16SRodney W. Grimesdoes not require an account or password on the remote system. 70ea022d16SRodney W. GrimesDue to the lack of authentication information, 71a8faeabcSPhilippe Charnier.Nm 72ea022d16SRodney W. Grimeswill allow only publicly readable files to be 73ea022d16SRodney W. Grimesaccessed. 74ff7e281dSYaroslav TykhiyFiles containing the string 75ff7e281dSYaroslav Tykhiy.Dq Li "/../" 76ff7e281dSYaroslav Tykhiyor starting with 77ff7e281dSYaroslav Tykhiy.Dq Li "../" 78ff7e281dSYaroslav Tykhiyare not allowed. 79ea022d16SRodney W. GrimesFiles may be written only if they already exist and are publicly writable. 80ea022d16SRodney W. GrimesNote that this extends the concept of 81ea022d16SRodney W. Grimes.Dq public 82ea022d16SRodney W. Grimesto include 83ea022d16SRodney W. Grimesall users on all hosts that can be reached through the network; 84ea022d16SRodney W. Grimesthis may not be appropriate on all systems, and its implications 85ea022d16SRodney W. Grimesshould be considered before enabling tftp service. 86ea022d16SRodney W. GrimesThe server should have the user ID with the lowest possible privilege. 87ea022d16SRodney W. Grimes.Pp 88ea022d16SRodney W. GrimesAccess to files may be restricted by invoking 89a8faeabcSPhilippe Charnier.Nm 90ea022d16SRodney W. Grimeswith a list of directories by including up to 20 pathnames 91ea022d16SRodney W. Grimesas server program arguments in 92ff7e281dSYaroslav Tykhiy.Xr inetd.conf 5 . 93ea022d16SRodney W. GrimesIn this case access is restricted to files whose 94ea022d16SRodney W. Grimesnames are prefixed by the one of the given directories. 95ea022d16SRodney W. GrimesThe given directories are also treated as a search path for 96ea022d16SRodney W. Grimesrelative filename requests. 97ea022d16SRodney W. Grimes.Pp 98f62eaadfSGarrett WollmanThe 99a8faeabcSPhilippe Charnier.Fl s 100f62eaadfSGarrett Wollmanoption provides additional security by changing 101ff7e281dSYaroslav Tykhiythe root directory of 102ff7e281dSYaroslav Tykhiy.Nm , 103ff7e281dSYaroslav Tykhiythereby prohibiting accesses to outside of the specified 104f62eaadfSGarrett Wollman.Ar directory . 105f62eaadfSGarrett WollmanBecause 106f62eaadfSGarrett Wollman.Xr chroot 2 107f62eaadfSGarrett Wollmanrequires super-user privileges, 108a8faeabcSPhilippe Charnier.Nm 109ff7e281dSYaroslav Tykhiymust be run as 110ff7e281dSYaroslav Tykhiy.Li root . 111f62eaadfSGarrett WollmanHowever, after performing the 112ff7e281dSYaroslav Tykhiy.Xr chroot 2 113ff7e281dSYaroslav Tykhiycall, 114a8faeabcSPhilippe Charnier.Nm 115ff7e281dSYaroslav Tykhiywill set its user ID to that of the specified 116f62eaadfSGarrett Wollman.Ar user , 117f62eaadfSGarrett Wollmanor 118ff7e281dSYaroslav Tykhiy.Dq Li nobody 119f62eaadfSGarrett Wollmanif no 120f62eaadfSGarrett Wollman.Fl u 121f62eaadfSGarrett Wollmanoption is specified. 1228ea31785SWarner Losh.Pp 123ea022d16SRodney W. GrimesThe options are: 124ea022d16SRodney W. Grimes.Bl -tag -width Ds 1251ed0e5d2SBill Fumerola.It Fl c 126ff7e281dSYaroslav TykhiyChanges the default root directory of a connecting host via 127ff7e281dSYaroslav Tykhiy.Xr chroot 2 128ff7e281dSYaroslav Tykhiybased on the connecting IP address. 1291ed0e5d2SBill FumerolaThis prevents multiple clients from writing to the same file at the same time. 1301ed0e5d2SBill FumerolaIf the directory does not exist, the client connection is refused. 1311ed0e5d2SBill FumerolaThe 1321ed0e5d2SBill Fumerola.Fl s 1331ed0e5d2SBill Fumerolaoption is required for 1341ed0e5d2SBill Fumerola.Fl c 1351ed0e5d2SBill Fumerolaand the specified 1361ed0e5d2SBill Fumerola.Ar directory 1371ed0e5d2SBill Fumerolais used as a base. 1381ed0e5d2SBill Fumerola.It Fl C 1391ed0e5d2SBill FumerolaOperates the same as 1401ed0e5d2SBill Fumerola.Fl c 1411ed0e5d2SBill Fumerolaexcept it falls back to 1421ed0e5d2SBill Fumerola.Ar directory 143ff7e281dSYaroslav Tykhiyspecified via 144ff7e281dSYaroslav Tykhiy.Fl s 1451ed0e5d2SBill Fumerolaif a directory does not exist for the client's IP. 146dba0fd30SEdwin Groothuis.It Fl F 147dba0fd30SEdwin GroothuisUse this 148dba0fd30SEdwin Groothuis.Xr strftime 3 149dba0fd30SEdwin Groothuiscompatible format string for the creation of the suffix if 150dba0fd30SEdwin Groothuis.Fl W 151dba0fd30SEdwin Groothuisis specified. 152dba0fd30SEdwin GroothuisBy default the string "%Y%m%d" is used. 153a1aea88aSCraig Rodrigues.It Fl d, d Ar [value] 1545276e639SWarner LoshEnables debug output. 155a1aea88aSCraig RodriguesIf 156a1aea88aSCraig Rodrigues.Ar value 157a1aea88aSCraig Rodriguesis not specified, then the debug level is increased by one 158a1aea88aSCraig Rodriguesfor each instance of 159a1aea88aSCraig Rodrigues.Fl d 160a1aea88aSCraig Rodrigueswhich is specified. 161a1aea88aSCraig Rodrigues.Pp 162a1aea88aSCraig RodriguesIf 163a1aea88aSCraig Rodrigues.Ar value 164a1aea88aSCraig Rodriguesis specified, then the debug level is set to 165a1aea88aSCraig Rodrigues.Ar value . 166a1aea88aSCraig RodriguesThe debug level is a bitmask implemented in 167a1aea88aSCraig Rodrigues.Pa src/libexec/tftpd/tftp-utils.h . 168a1aea88aSCraig RodriguesValid values are 0 (DEBUG_NONE), 1 (DEBUG_PACKETS), 2, (DEBUG_SIMPLE), 169a1aea88aSCraig Rodrigues4 (DEBUG_OPTIONS), and 8 (DEBUG_ACCESS). Multiple debug values can be combined 170a1aea88aSCraig Rodriguesin the bitmask by logically OR'ing the values. For example, specifying 171a1aea88aSCraig Rodrigues.Fl d 172a1aea88aSCraig Rodrigues.Ar 15 173a1aea88aSCraig Rodrigueswill enable all the debug values. 174ea022d16SRodney W. Grimes.It Fl l 175a8faeabcSPhilippe CharnierLog all requests using 1763dead0b6SJoseph Koshy.Xr syslog 3 177f62eaadfSGarrett Wollmanwith the facility of 178f62eaadfSGarrett Wollman.Dv LOG_FTP . 179ff7e281dSYaroslav Tykhiy.Sy Note : 180ff7e281dSYaroslav TykhiyLogging of 181f62eaadfSGarrett Wollman.Dv LOG_FTP 182f62eaadfSGarrett Wollmanmessages 183f62eaadfSGarrett Wollmanmust also be enabled in the syslog configuration file, 1843dead0b6SJoseph Koshy.Xr syslog.conf 5 . 185ea022d16SRodney W. Grimes.It Fl n 186a8faeabcSPhilippe CharnierSuppress negative acknowledgement of requests for nonexistent 187ea022d16SRodney W. Grimesrelative filenames. 1885276e639SWarner Losh.It Fl o 1895276e639SWarner LoshDisable support for RFC2347 style TFTP Options. 1908ea31785SWarner Losh.It Fl s Ar directory 191a8faeabcSPhilippe CharnierCause 192a8faeabcSPhilippe Charnier.Nm 193f62eaadfSGarrett Wollmanto change its root directory to 194ff7e281dSYaroslav Tykhiy.Ar directory . 195ff7e281dSYaroslav TykhiyAfter doing that but before accepting commands, 196a8faeabcSPhilippe Charnier.Nm 197f62eaadfSGarrett Wollmanwill switch credentials to an unprivileged user. 198f62eaadfSGarrett Wollman.It Fl u Ar user 199f62eaadfSGarrett WollmanSwitch credentials to 200f62eaadfSGarrett Wollman.Ar user 201f62eaadfSGarrett Wollman(default 202ff7e281dSYaroslav Tykhiy.Dq Li nobody ) 203f62eaadfSGarrett Wollmanwhen the 204f62eaadfSGarrett Wollman.Fl s 205f62eaadfSGarrett Wollmanoption is used. 206f62eaadfSGarrett WollmanThe user must be specified by name, not a numeric UID. 207eff77877SMatthew N. Dodd.It Fl U Ar umask 208eff77877SMatthew N. DoddSet the 209eff77877SMatthew N. Dodd.Ar umask 2102410103cSRuslan Ermilovfor newly created files. 2112410103cSRuslan ErmilovThe default is 022 212a3ec17dbSRuslan Ermilov.Pq Dv S_IWGRP | S_IWOTH . 213eff77877SMatthew N. Dodd.It Fl w 21441d05ce7SBjoern A. ZeebAllow write requests to create new files. 2152410103cSRuslan ErmilovBy default 216eff77877SMatthew N. Dodd.Nm 217eff77877SMatthew N. Doddrequires that the file specified in a write request exist. 218dba0fd30SEdwin GroothuisNote that this only works in directories writable by the user 219dba0fd30SEdwin Groothuisspecified with 220dba0fd30SEdwin Groothuis.Fl u 221dba0fd30SEdwin Groothuisoption 222dba0fd30SEdwin Groothuis.It Fl W 223dba0fd30SEdwin GroothuisAs 224dba0fd30SEdwin Groothuis.Fl w 225dba0fd30SEdwin Groothuisbut append a YYYYMMDD.nn sequence number to the end of the filename. 226b71d8e69SEdwin GroothuisNote that the string YYYYMMDD can be changed with the 227dba0fd30SEdwin Groothuis.Fl F 228dba0fd30SEdwin Groothuisoption. 229ea022d16SRodney W. Grimes.El 230ea022d16SRodney W. Grimes.Sh SEE ALSO 231ea022d16SRodney W. Grimes.Xr tftp 1 , 232f62eaadfSGarrett Wollman.Xr chroot 2 , 233ff7e281dSYaroslav Tykhiy.Xr syslog 3 , 234ff7e281dSYaroslav Tykhiy.Xr inetd.conf 5 , 235ff7e281dSYaroslav Tykhiy.Xr services 5 , 236ff7e281dSYaroslav Tykhiy.Xr syslog.conf 5 , 237ff7e281dSYaroslav Tykhiy.Xr inetd 8 238957af43fSCraig Rodrigues.Pp 239957af43fSCraig RodriguesThe following RFC's are supported: 240f62eaadfSGarrett Wollman.Rs 241957af43fSCraig RodriguesRFC 1350 242f62eaadfSGarrett Wollman.%T The TFTP Protocol (Revision 2) 243957af43fSCraig Rodrigues.Re 244957af43fSCraig Rodrigues.Rs 245957af43fSCraig RodriguesRFC 2347 246957af43fSCraig Rodrigues.%T TFTP Option Extension 247957af43fSCraig Rodrigues.Re 248957af43fSCraig Rodrigues.Rs 249957af43fSCraig RodriguesRFC 2348 250957af43fSCraig Rodrigues.%T TFTP Blocksize Option 251957af43fSCraig Rodrigues.Re 252957af43fSCraig Rodrigues.Rs 253957af43fSCraig RodriguesRFC 2349 254957af43fSCraig Rodrigues.%T TFTP Timeout Interval and Transfer Size Options 255957af43fSCraig Rodrigues.Re 256957af43fSCraig Rodrigues.Pp 257957af43fSCraig RodriguesThe non-standard 258957af43fSCraig Rodrigues.Cm rollover 259957af43fSCraig Rodriguesand 260957af43fSCraig Rodrigues.Cm blksize2 261957af43fSCraig RodriguesTFTP options are mentioned here: 262957af43fSCraig Rodrigues.Rs 263957af43fSCraig Rodrigues.%T Extending TFTP 264957af43fSCraig Rodrigues.%U http://www.compuphase.com/tftp.htm 265f62eaadfSGarrett Wollman.Re 266ea022d16SRodney W. Grimes.Sh HISTORY 267ea022d16SRodney W. GrimesThe 268ea022d16SRodney W. Grimes.Nm 2693f162cb8SPhilippe Charnierutility appeared in 27067c31d50SGarrett Wollman.Bx 4.2 ; 27167c31d50SGarrett Wollmanthe 27267c31d50SGarrett Wollman.Fl s 27367c31d50SGarrett Wollmanoption was introduced in 27467c31d50SGarrett Wollman.Fx 2.2 , 2751ed0e5d2SBill Fumerolathe 27667c31d50SGarrett Wollman.Fl u 27767c31d50SGarrett Wollmanoption was introduced in 2781ed0e5d2SBill Fumerola.Fx 4.2 , 279dba0fd30SEdwin Groothuisthe 2801ed0e5d2SBill Fumerola.Fl c 2811ed0e5d2SBill Fumerolaoption was introduced in 282dba0fd30SEdwin Groothuis.Fx 4.3 , 283dba0fd30SEdwin Groothuisand the 284dba0fd30SEdwin Groothuis.Fl F 285dba0fd30SEdwin Groothuisand 286dba0fd30SEdwin Groothuis.Fl W 287dba0fd30SEdwin Groothuisoptions were introduced in 28886a04a0cSXin LI.Fx 7.4 . 289dba0fd30SEdwin Groothuis.Pp 2905276e639SWarner LoshSupport for Timeout Interval and Transfer Size Options (RFC2349) 2915276e639SWarner Loshwas introduced in 2925276e639SWarner Losh.Fx 5.0 , 2935276e639SWarner Loshsupport for the TFTP Blocksize Option (RFC2348) and the blksize2 option 2945276e639SWarner Loshwas introduced in 29586a04a0cSXin LI.Fx 7.4 . 296f6c506d9SCraig Rodrigues.Pp 297f6c506d9SCraig RodriguesEdwin Groothuis <edwin@FreeBSD.org> performed a major rewrite of the 298f6c506d9SCraig Rodrigues.Nm 299f6c506d9SCraig Rodriguesand 300f6c506d9SCraig Rodrigues.Xr tftp 1 301f6c506d9SCraig Rodriguescode to support RFC2348. 302e5660633SCraig Rodrigues.Sh NOTES 303*46d20cbcSCraig RodriguesFiles larger than 33,553,919 octets (65535 blocks, last one <512 304*46d20cbcSCraig Rodriguesoctets) cannot be correctly transferred without client and server 305*46d20cbcSCraig Rodriguessupporting blocksize negotiation (RFCs 2347 and 2348), 306e5660633SCraig Rodriguesor the non-standard TFTP rollover option. 307*46d20cbcSCraig RodriguesAs a kludge, 308*46d20cbcSCraig Rodrigues.Nm 309*46d20cbcSCraig Rodriguesaccepts a sequence of block number which wrap to zero after 65535, 310*46d20cbcSCraig Rodrigueseven if the rollover option is not specified. 31167034ac6SJeroen Ruigrok van der Werven.Pp 312*46d20cbcSCraig RodriguesMany tftp clients will not transfer files over 16,776,703 octets 313*46d20cbcSCraig Rodrigues(32767 blocks), as they incorrectly count the block number using 314*46d20cbcSCraig Rodriguesa signed rather than unsigned 16-bit integer. 315