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. 12*5efaea4cSChristian Brueffer.\" 3. Neither the name of the University nor the names of its contributors 13ea022d16SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 14ea022d16SRodney W. Grimes.\" without specific prior written permission. 15ea022d16SRodney W. Grimes.\" 16ea022d16SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17ea022d16SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18ea022d16SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19ea022d16SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20ea022d16SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21ea022d16SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22ea022d16SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23ea022d16SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24ea022d16SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25ea022d16SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26ea022d16SRodney W. Grimes.\" SUCH DAMAGE. 27ea022d16SRodney W. Grimes.\" 28ea022d16SRodney W. Grimes.\" @(#)tftpd.8 8.1 (Berkeley) 6/4/93 29229494cbSMike Pritchard.\" $FreeBSD$ 30ea022d16SRodney W. Grimes.\" 31a1aea88aSCraig Rodrigues.Dd June 22, 2011 32ea022d16SRodney W. Grimes.Dt TFTPD 8 330efe23d6SRuslan Ermilov.Os 34ea022d16SRodney W. Grimes.Sh NAME 35ea022d16SRodney W. Grimes.Nm tftpd 36eb083802SRuslan Ermilov.Nd Internet Trivial File Transfer Protocol server 37ea022d16SRodney W. Grimes.Sh SYNOPSIS 38ff7e281dSYaroslav Tykhiy.Nm tftpd 395276e639SWarner Losh.Op Fl cdClnow 40dba0fd30SEdwin Groothuis.Op Fl F Ar strftime-format 418ea31785SWarner Losh.Op Fl s Ar directory 42f62eaadfSGarrett Wollman.Op Fl u Ar user 43eff77877SMatthew N. Dodd.Op Fl U Ar umask 44ea022d16SRodney W. Grimes.Op Ar directory ... 45ea022d16SRodney W. Grimes.Sh DESCRIPTION 463f162cb8SPhilippe CharnierThe 473f162cb8SPhilippe Charnier.Nm 483f162cb8SPhilippe Charnierutility is a server which supports the 49ea022d16SRodney W. GrimesInternet Trivial File Transfer 50f62eaadfSGarrett WollmanProtocol 51f62eaadfSGarrett Wollman.Pq Tn RFC 1350 . 52ea022d16SRodney W. GrimesThe 53ea022d16SRodney W. Grimes.Tn TFTP 54ea022d16SRodney W. Grimesserver operates 55ea022d16SRodney W. Grimesat the port indicated in the 56ea022d16SRodney W. Grimes.Ql tftp 57ea022d16SRodney W. Grimesservice description; 58ea022d16SRodney W. Grimessee 59ea022d16SRodney W. Grimes.Xr services 5 . 60ea022d16SRodney W. GrimesThe server is normally started by 61ea022d16SRodney W. Grimes.Xr inetd 8 . 62ea022d16SRodney W. Grimes.Pp 63ea022d16SRodney W. GrimesThe use of 64ea022d16SRodney W. Grimes.Xr tftp 1 65ea022d16SRodney W. Grimesdoes not require an account or password on the remote system. 66ea022d16SRodney W. GrimesDue to the lack of authentication information, 67a8faeabcSPhilippe Charnier.Nm 68ea022d16SRodney W. Grimeswill allow only publicly readable files to be 69ea022d16SRodney W. Grimesaccessed. 70ff7e281dSYaroslav TykhiyFiles containing the string 71ff7e281dSYaroslav Tykhiy.Dq Li "/../" 72ff7e281dSYaroslav Tykhiyor starting with 73ff7e281dSYaroslav Tykhiy.Dq Li "../" 74ff7e281dSYaroslav Tykhiyare not allowed. 75ea022d16SRodney W. GrimesFiles may be written only if they already exist and are publicly writable. 76ea022d16SRodney W. GrimesNote that this extends the concept of 77ea022d16SRodney W. Grimes.Dq public 78ea022d16SRodney W. Grimesto include 79ea022d16SRodney W. Grimesall users on all hosts that can be reached through the network; 80ea022d16SRodney W. Grimesthis may not be appropriate on all systems, and its implications 81ea022d16SRodney W. Grimesshould be considered before enabling tftp service. 82ea022d16SRodney W. GrimesThe server should have the user ID with the lowest possible privilege. 83ea022d16SRodney W. Grimes.Pp 84ea022d16SRodney W. GrimesAccess to files may be restricted by invoking 85a8faeabcSPhilippe Charnier.Nm 86ea022d16SRodney W. Grimeswith a list of directories by including up to 20 pathnames 87ea022d16SRodney W. Grimesas server program arguments in 88ff7e281dSYaroslav Tykhiy.Xr inetd.conf 5 . 89ea022d16SRodney W. GrimesIn this case access is restricted to files whose 90ea022d16SRodney W. Grimesnames are prefixed by the one of the given directories. 91ea022d16SRodney W. GrimesThe given directories are also treated as a search path for 92ea022d16SRodney W. Grimesrelative filename requests. 93ea022d16SRodney W. Grimes.Pp 94f62eaadfSGarrett WollmanThe 95a8faeabcSPhilippe Charnier.Fl s 96f62eaadfSGarrett Wollmanoption provides additional security by changing 97ff7e281dSYaroslav Tykhiythe root directory of 98ff7e281dSYaroslav Tykhiy.Nm , 99ff7e281dSYaroslav Tykhiythereby prohibiting accesses to outside of the specified 100f62eaadfSGarrett Wollman.Ar directory . 101f62eaadfSGarrett WollmanBecause 102f62eaadfSGarrett Wollman.Xr chroot 2 103f62eaadfSGarrett Wollmanrequires super-user privileges, 104a8faeabcSPhilippe Charnier.Nm 105ff7e281dSYaroslav Tykhiymust be run as 106ff7e281dSYaroslav Tykhiy.Li root . 107f62eaadfSGarrett WollmanHowever, after performing the 108ff7e281dSYaroslav Tykhiy.Xr chroot 2 109ff7e281dSYaroslav Tykhiycall, 110a8faeabcSPhilippe Charnier.Nm 111ff7e281dSYaroslav Tykhiywill set its user ID to that of the specified 112f62eaadfSGarrett Wollman.Ar user , 113f62eaadfSGarrett Wollmanor 114ff7e281dSYaroslav Tykhiy.Dq Li nobody 115f62eaadfSGarrett Wollmanif no 116f62eaadfSGarrett Wollman.Fl u 117f62eaadfSGarrett Wollmanoption is specified. 1188ea31785SWarner Losh.Pp 119ea022d16SRodney W. GrimesThe options are: 120ea022d16SRodney W. Grimes.Bl -tag -width Ds 1211ed0e5d2SBill Fumerola.It Fl c 122ff7e281dSYaroslav TykhiyChanges the default root directory of a connecting host via 123ff7e281dSYaroslav Tykhiy.Xr chroot 2 124ff7e281dSYaroslav Tykhiybased on the connecting IP address. 1251ed0e5d2SBill FumerolaThis prevents multiple clients from writing to the same file at the same time. 1261ed0e5d2SBill FumerolaIf the directory does not exist, the client connection is refused. 1271ed0e5d2SBill FumerolaThe 1281ed0e5d2SBill Fumerola.Fl s 1291ed0e5d2SBill Fumerolaoption is required for 1301ed0e5d2SBill Fumerola.Fl c 1311ed0e5d2SBill Fumerolaand the specified 1321ed0e5d2SBill Fumerola.Ar directory 1331ed0e5d2SBill Fumerolais used as a base. 1341ed0e5d2SBill Fumerola.It Fl C 1351ed0e5d2SBill FumerolaOperates the same as 1361ed0e5d2SBill Fumerola.Fl c 1371ed0e5d2SBill Fumerolaexcept it falls back to 1381ed0e5d2SBill Fumerola.Ar directory 139ff7e281dSYaroslav Tykhiyspecified via 140ff7e281dSYaroslav Tykhiy.Fl s 1411ed0e5d2SBill Fumerolaif a directory does not exist for the client's IP. 142dba0fd30SEdwin Groothuis.It Fl F 143dba0fd30SEdwin GroothuisUse this 144dba0fd30SEdwin Groothuis.Xr strftime 3 145dba0fd30SEdwin Groothuiscompatible format string for the creation of the suffix if 146dba0fd30SEdwin Groothuis.Fl W 147dba0fd30SEdwin Groothuisis specified. 148dba0fd30SEdwin GroothuisBy default the string "%Y%m%d" is used. 149a1aea88aSCraig Rodrigues.It Fl d, d Ar [value] 1505276e639SWarner LoshEnables debug output. 151a1aea88aSCraig RodriguesIf 152a1aea88aSCraig Rodrigues.Ar value 153a1aea88aSCraig Rodriguesis not specified, then the debug level is increased by one 154a1aea88aSCraig Rodriguesfor each instance of 155a1aea88aSCraig Rodrigues.Fl d 156a1aea88aSCraig Rodrigueswhich is specified. 157a1aea88aSCraig Rodrigues.Pp 158a1aea88aSCraig RodriguesIf 159a1aea88aSCraig Rodrigues.Ar value 160a1aea88aSCraig Rodriguesis specified, then the debug level is set to 161a1aea88aSCraig Rodrigues.Ar value . 162a1aea88aSCraig RodriguesThe debug level is a bitmask implemented in 163a1aea88aSCraig Rodrigues.Pa src/libexec/tftpd/tftp-utils.h . 164a1aea88aSCraig RodriguesValid values are 0 (DEBUG_NONE), 1 (DEBUG_PACKETS), 2, (DEBUG_SIMPLE), 165a1aea88aSCraig Rodrigues4 (DEBUG_OPTIONS), and 8 (DEBUG_ACCESS). Multiple debug values can be combined 166a1aea88aSCraig Rodriguesin the bitmask by logically OR'ing the values. For example, specifying 167a1aea88aSCraig Rodrigues.Fl d 168a1aea88aSCraig Rodrigues.Ar 15 169a1aea88aSCraig Rodrigueswill enable all the debug values. 170ea022d16SRodney W. Grimes.It Fl l 171a8faeabcSPhilippe CharnierLog all requests using 1723dead0b6SJoseph Koshy.Xr syslog 3 173f62eaadfSGarrett Wollmanwith the facility of 174f62eaadfSGarrett Wollman.Dv LOG_FTP . 175ff7e281dSYaroslav Tykhiy.Sy Note : 176ff7e281dSYaroslav TykhiyLogging of 177f62eaadfSGarrett Wollman.Dv LOG_FTP 178f62eaadfSGarrett Wollmanmessages 179f62eaadfSGarrett Wollmanmust also be enabled in the syslog configuration file, 1803dead0b6SJoseph Koshy.Xr syslog.conf 5 . 181ea022d16SRodney W. Grimes.It Fl n 182a8faeabcSPhilippe CharnierSuppress negative acknowledgement of requests for nonexistent 183ea022d16SRodney W. Grimesrelative filenames. 1845276e639SWarner Losh.It Fl o 1855276e639SWarner LoshDisable support for RFC2347 style TFTP Options. 1868ea31785SWarner Losh.It Fl s Ar directory 187a8faeabcSPhilippe CharnierCause 188a8faeabcSPhilippe Charnier.Nm 189f62eaadfSGarrett Wollmanto change its root directory to 190ff7e281dSYaroslav Tykhiy.Ar directory . 191ff7e281dSYaroslav TykhiyAfter doing that but before accepting commands, 192a8faeabcSPhilippe Charnier.Nm 193f62eaadfSGarrett Wollmanwill switch credentials to an unprivileged user. 194f62eaadfSGarrett Wollman.It Fl u Ar user 195f62eaadfSGarrett WollmanSwitch credentials to 196f62eaadfSGarrett Wollman.Ar user 197f62eaadfSGarrett Wollman(default 198ff7e281dSYaroslav Tykhiy.Dq Li nobody ) 199f62eaadfSGarrett Wollmanwhen the 200f62eaadfSGarrett Wollman.Fl s 201f62eaadfSGarrett Wollmanoption is used. 202f62eaadfSGarrett WollmanThe user must be specified by name, not a numeric UID. 203eff77877SMatthew N. Dodd.It Fl U Ar umask 204eff77877SMatthew N. DoddSet the 205eff77877SMatthew N. Dodd.Ar umask 2062410103cSRuslan Ermilovfor newly created files. 2072410103cSRuslan ErmilovThe default is 022 208a3ec17dbSRuslan Ermilov.Pq Dv S_IWGRP | S_IWOTH . 209eff77877SMatthew N. Dodd.It Fl w 21041d05ce7SBjoern A. ZeebAllow write requests to create new files. 2112410103cSRuslan ErmilovBy default 212eff77877SMatthew N. Dodd.Nm 213eff77877SMatthew N. Doddrequires that the file specified in a write request exist. 214dba0fd30SEdwin GroothuisNote that this only works in directories writable by the user 215dba0fd30SEdwin Groothuisspecified with 216dba0fd30SEdwin Groothuis.Fl u 217dba0fd30SEdwin Groothuisoption 218dba0fd30SEdwin Groothuis.It Fl W 219dba0fd30SEdwin GroothuisAs 220dba0fd30SEdwin Groothuis.Fl w 221dba0fd30SEdwin Groothuisbut append a YYYYMMDD.nn sequence number to the end of the filename. 222b71d8e69SEdwin GroothuisNote that the string YYYYMMDD can be changed with the 223dba0fd30SEdwin Groothuis.Fl F 224dba0fd30SEdwin Groothuisoption. 225ea022d16SRodney W. Grimes.El 226ea022d16SRodney W. Grimes.Sh SEE ALSO 227ea022d16SRodney W. Grimes.Xr tftp 1 , 228f62eaadfSGarrett Wollman.Xr chroot 2 , 229ff7e281dSYaroslav Tykhiy.Xr syslog 3 , 230ff7e281dSYaroslav Tykhiy.Xr inetd.conf 5 , 231ff7e281dSYaroslav Tykhiy.Xr services 5 , 232ff7e281dSYaroslav Tykhiy.Xr syslog.conf 5 , 233ff7e281dSYaroslav Tykhiy.Xr inetd 8 234957af43fSCraig Rodrigues.Pp 235957af43fSCraig RodriguesThe following RFC's are supported: 236f62eaadfSGarrett Wollman.Rs 2379c282daaSJoel Dahl.%T RFC 1350: The TFTP Protocol (Revision 2) 238957af43fSCraig Rodrigues.Re 239957af43fSCraig Rodrigues.Rs 2409c282daaSJoel Dahl.%T RFC 2347: TFTP Option Extension 241957af43fSCraig Rodrigues.Re 242957af43fSCraig Rodrigues.Rs 2439c282daaSJoel Dahl.%T RFC 2348: TFTP Blocksize Option 244957af43fSCraig Rodrigues.Re 245957af43fSCraig Rodrigues.Rs 2469c282daaSJoel Dahl.%T RFC 2349: TFTP Timeout Interval and Transfer Size Options 247957af43fSCraig Rodrigues.Re 248957af43fSCraig Rodrigues.Pp 249957af43fSCraig RodriguesThe non-standard 250957af43fSCraig Rodrigues.Cm rollover 251957af43fSCraig Rodriguesand 252957af43fSCraig Rodrigues.Cm blksize2 253957af43fSCraig RodriguesTFTP options are mentioned here: 254957af43fSCraig Rodrigues.Rs 255957af43fSCraig Rodrigues.%T Extending TFTP 256957af43fSCraig Rodrigues.%U http://www.compuphase.com/tftp.htm 257f62eaadfSGarrett Wollman.Re 258ea022d16SRodney W. Grimes.Sh HISTORY 259ea022d16SRodney W. GrimesThe 260ea022d16SRodney W. Grimes.Nm 2613f162cb8SPhilippe Charnierutility appeared in 26267c31d50SGarrett Wollman.Bx 4.2 ; 26367c31d50SGarrett Wollmanthe 26467c31d50SGarrett Wollman.Fl s 26567c31d50SGarrett Wollmanoption was introduced in 26667c31d50SGarrett Wollman.Fx 2.2 , 2671ed0e5d2SBill Fumerolathe 26867c31d50SGarrett Wollman.Fl u 26967c31d50SGarrett Wollmanoption was introduced in 2701ed0e5d2SBill Fumerola.Fx 4.2 , 271dba0fd30SEdwin Groothuisthe 2721ed0e5d2SBill Fumerola.Fl c 2731ed0e5d2SBill Fumerolaoption was introduced in 274dba0fd30SEdwin Groothuis.Fx 4.3 , 275dba0fd30SEdwin Groothuisand the 276dba0fd30SEdwin Groothuis.Fl F 277dba0fd30SEdwin Groothuisand 278dba0fd30SEdwin Groothuis.Fl W 279dba0fd30SEdwin Groothuisoptions were introduced in 28086a04a0cSXin LI.Fx 7.4 . 281dba0fd30SEdwin Groothuis.Pp 2825276e639SWarner LoshSupport for Timeout Interval and Transfer Size Options (RFC2349) 2835276e639SWarner Loshwas introduced in 2845276e639SWarner Losh.Fx 5.0 , 2855276e639SWarner Loshsupport for the TFTP Blocksize Option (RFC2348) and the blksize2 option 2865276e639SWarner Loshwas introduced in 28786a04a0cSXin LI.Fx 7.4 . 288f6c506d9SCraig Rodrigues.Pp 289f6c506d9SCraig RodriguesEdwin Groothuis <edwin@FreeBSD.org> performed a major rewrite of the 290f6c506d9SCraig Rodrigues.Nm 291f6c506d9SCraig Rodriguesand 292f6c506d9SCraig Rodrigues.Xr tftp 1 293f6c506d9SCraig Rodriguescode to support RFC2348. 294e5660633SCraig Rodrigues.Sh NOTES 29546d20cbcSCraig RodriguesFiles larger than 33,553,919 octets (65535 blocks, last one <512 29646d20cbcSCraig Rodriguesoctets) cannot be correctly transferred without client and server 29746d20cbcSCraig Rodriguessupporting blocksize negotiation (RFCs 2347 and 2348), 298e5660633SCraig Rodriguesor the non-standard TFTP rollover option. 29946d20cbcSCraig RodriguesAs a kludge, 30046d20cbcSCraig Rodrigues.Nm 30146d20cbcSCraig Rodriguesaccepts a sequence of block number which wrap to zero after 65535, 30246d20cbcSCraig Rodrigueseven if the rollover option is not specified. 30367034ac6SJeroen Ruigrok van der Werven.Pp 30446d20cbcSCraig RodriguesMany tftp clients will not transfer files over 16,776,703 octets 30546d20cbcSCraig Rodrigues(32767 blocks), as they incorrectly count the block number using 30646d20cbcSCraig Rodriguesa signed rather than unsigned 16-bit integer. 307