xref: /openbsd-src/usr.sbin/tftpd/tftpd.8 (revision 7e4b292b69864d07e08cf9769451effe09b024f8)
1*7e4b292bSjmc.\"   $OpenBSD: tftpd.8,v 1.10 2022/10/05 05:40:16 jmc Exp $
28871c557Sdlg.\"
38871c557Sdlg.\" Copyright (c) 1983, 1991 The Regents of the University of California.
48871c557Sdlg.\" All rights reserved.
58871c557Sdlg.\"
68871c557Sdlg.\" Redistribution and use in source and binary forms, with or without
78871c557Sdlg.\" modification, are permitted provided that the following conditions
88871c557Sdlg.\" are met:
98871c557Sdlg.\" 1. Redistributions of source code must retain the above copyright
108871c557Sdlg.\"    notice, this list of conditions and the following disclaimer.
118871c557Sdlg.\" 2. Redistributions in binary form must reproduce the above copyright
128871c557Sdlg.\"    notice, this list of conditions and the following disclaimer in the
138871c557Sdlg.\"    documentation and/or other materials provided with the distribution.
148871c557Sdlg.\" 3. Neither the name of the University nor the names of its contributors
158871c557Sdlg.\"    may be used to endorse or promote products derived from this software
168871c557Sdlg.\"    without specific prior written permission.
178871c557Sdlg.\"
188871c557Sdlg.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
198871c557Sdlg.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
208871c557Sdlg.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
218871c557Sdlg.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
228871c557Sdlg.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
238871c557Sdlg.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
248871c557Sdlg.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
258871c557Sdlg.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
268871c557Sdlg.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
278871c557Sdlg.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
288871c557Sdlg.\" SUCH DAMAGE.
298871c557Sdlg.\"
308871c557Sdlg.\"	from: @(#)tftpd.8	6.7 (Berkeley) 5/13/91
318871c557Sdlg.\"
32*7e4b292bSjmc.Dd $Mdocdate: October 5 2022 $
338871c557Sdlg.Dt TFTPD 8
348871c557Sdlg.Os
358871c557Sdlg.Sh NAME
368871c557Sdlg.Nm tftpd
37e1bd8174Sderaadt.Nd Trivial File Transfer Protocol daemon
388871c557Sdlg.Sh SYNOPSIS
398871c557Sdlg.Nm tftpd
40a5c6d06aSkn.Op Fl 46cdivw
418871c557Sdlg.Op Fl l Ar address
428871c557Sdlg.Op Fl p Ar port
43f2422c7fSjmc.Op Fl r Ar socket
448871c557Sdlg.Ar directory
458871c557Sdlg.Sh DESCRIPTION
468871c557Sdlg.Nm
478871c557Sdlgis a server which implements the
488871c557SdlgTrivial File Transfer Protocol.
498871c557Sdlg.Pp
508871c557SdlgThe use of
518871c557Sdlg.Xr tftp 1
528871c557Sdlgdoes not require an account or password on the remote system.
538871c557SdlgDue to the lack of authentication information,
548871c557Sdlg.Nm
558871c557Sdlgwill allow only publicly readable files to be accessed.
56a5c6d06aSknBy default files may only be read, unless the
57a5c6d06aSkn.Fl w
58a5c6d06aSknoption is specified.
598871c557SdlgFiles may be written only if they already exist and are publicly writable,
608871c557Sdlgunless the
618871c557Sdlg.Fl c
62a5c6d06aSknflag is specified.
638871c557SdlgNote that this extends the concept of
648871c557Sdlg.Dq public
658871c557Sdlgto include
668871c557Sdlgall users on all hosts that can be reached through the network;
678871c557Sdlgthis may not be appropriate on all systems, and its implications
688871c557Sdlgshould be considered before enabling TFTP service.
698871c557Sdlg.Pp
708871c557SdlgThe server must be started as root, but will chroot to the
718871c557Sdlg.Ar directory
728871c557Sdlgspecified on the command line and drop privileges to the _tftpd user.
738871c557Sdlg.Pp
744a5fd927Smcbride.Nm tftpd
754a5fd927Smcbridealways provides random data at the path
764a5fd927Smcbride.Pa /etc/random.seed ,
774a5fd927Smcbrideand therefore this path will be ignored inside the
784a5fd927Smcbride.Ar directory .
794a5fd927Smcbride.Ox
804a5fd927Smcbridenetwork bootloaders access this path to harvest entropy during
814a5fd927Smcbridekernel load.
824a5fd927Smcbride.Pp
838871c557SdlgThe options are as follows:
848871c557Sdlg.Bl -tag -width Ds
858871c557Sdlg.It Fl 4
868871c557SdlgForces
878871c557Sdlg.Nm
888871c557Sdlgto use IPv4 addresses only.
898871c557Sdlg.It Fl 6
908871c557SdlgForces
918871c557Sdlg.Nm
928871c557Sdlgto use IPv6 addresses only.
938871c557Sdlg.It Fl c
948871c557SdlgAllow new files to be created;
958871c557Sdlgotherwise uploaded files must already exist.
968871c557SdlgFiles are created with default permissions
978871c557Sdlgallowing anyone to read or write to them.
98a5c6d06aSkn.Pp
99a5c6d06aSknThis option implies
100a5c6d06aSkn.Fl w .
1018871c557Sdlg.It Fl d
1028871c557SdlgDo not daemonize.
1038871c557SdlgIf this option is specified,
1048871c557Sdlg.Nm
105f2422c7fSjmcwill run in the foreground and log
106f2422c7fSjmcthe client IP, type of request, and filename to stderr.
107f923cd8eSjca.It Fl i
108f923cd8eSjcaLook up the requested path in the subdirectory named after the
109f923cd8eSjcaclient's IP address.
110f923cd8eSjcaFor read requests, if the file is not found,
111f923cd8eSjca.Nm
112f923cd8eSjcafalls back on the requested path.
113f923cd8eSjcaNote that no attempt is made to limit the client to its subdirectory.
114f923cd8eSjcaThis option cannot be combined with
115f923cd8eSjca.Fl r .
1168871c557Sdlg.It Fl l Ar address
1178871c557SdlgListen on the specified address.
1188871c557SdlgBy default
1198871c557Sdlg.Nm
1208871c557Sdlglistens on wildcard addresses.
1218871c557Sdlg.It Fl p Ar port
1228871c557SdlgListen on the specified port.
1238871c557SdlgBy default
1248871c557Sdlg.Nm
1258871c557Sdlglistens on the port indicated in the
1268871c557Sdlg.Ql tftp
1278871c557Sdlgservice description; see
1288871c557Sdlg.Xr services 5 .
1298871c557Sdlg.It Fl r Ar socket
1308871c557SdlgIssue filename rewrite requests to the specified UNIX domain socket.
131797db2e1Sdlg.Nm
132797db2e1Sdlgwill write lines in the format "IP OP filename", terminated by a newline,
133797db2e1Sdlgwhere IP is the client's IP address, and OP is one of "read" or "write".
134797db2e1Sdlg.Nm
135797db2e1Sdlgexpects replies in the format "filename" terminated by a newline.
136797db2e1SdlgAll rewrite requests from the daemon must be answered
137797db2e1Sdlg(even if it is with the original filename)
138797db2e1Sdlgbefore the TFTP request will continue.
1395da1c330SjmcBy default
1405da1c330Sjmc.Nm
1415da1c330Sjmcdoes not use filename rewriting.
142f923cd8eSjcaThis option cannot be combined with
143f923cd8eSjca.Fl i .
144f2422c7fSjmc.It Fl v
145f2422c7fSjmcLog the client IP, type of request, and filename.
146*7e4b292bSjmc.It Fl w
147*7e4b292bSjmcAllow files to be written to.
1488871c557Sdlg.It Ar directory
1498871c557Sdlg.Xr chroot 2
1508871c557Sdlgto
1518871c557Sdlg.Ar directory
1528871c557Sdlgon startup;
1538871c557Sdlgthe remote host is not expected to pass the directory
1548871c557Sdlgas part of the file name to transfer.
1558871c557Sdlg.El
1568871c557Sdlg.Sh SEE ALSO
1578871c557Sdlg.Xr tftp 1 ,
1588871c557Sdlg.Xr pxeboot 8 ,
1598871c557Sdlg.Xr syslogd 8 ,
1608871c557Sdlg.Xr tftp-proxy 8
161ea45dd54Sdlg.Sh STANDARDS
162ea45dd54Sdlg.\" .Rs
163ea45dd54Sdlg.\" .%A K. R. Sollins
164ea45dd54Sdlg.\" .%D June 1981
165ea45dd54Sdlg.\" .%R RFC 783
166ea45dd54Sdlg.\" .%T The TFTP Protocol (Revision 2)
167ea45dd54Sdlg.\" .Re
168ea45dd54Sdlg.\" .Pp
169ea45dd54Sdlg.Rs
170ea45dd54Sdlg.%A K. Sollins
171ea45dd54Sdlg.%D July 1992
172ea45dd54Sdlg.%R RFC 1350
173ea45dd54Sdlg.%T The TFTP Protocol (Revision 2)
174ea45dd54Sdlg.Re
175ea45dd54Sdlg.Pp
176ea45dd54Sdlg.\" .Rs
177ea45dd54Sdlg.\" .%A G. Malkin
178ea45dd54Sdlg.\" .%A A. Harkin
179ea45dd54Sdlg.\" .%D March 1995
180ea45dd54Sdlg.\" .%R RFC 1782
181ea45dd54Sdlg.\" .%T TFTP Option Extension
182ea45dd54Sdlg.\" .Re
183ea45dd54Sdlg.\" .Pp
184ea45dd54Sdlg.\" .Rs
185ea45dd54Sdlg.\" .%A G. Malkin
186ea45dd54Sdlg.\" .%A A. Harkin
187ea45dd54Sdlg.\" .%D March 1995
188ea45dd54Sdlg.\" .%R RFC 1783
189ea45dd54Sdlg.\" .%T TFTP Blocksize Option
190ea45dd54Sdlg.\" .Re
191ea45dd54Sdlg.\" .Pp
192ea45dd54Sdlg.\" .Rs
193ea45dd54Sdlg.\" .%A G. Malkin
194ea45dd54Sdlg.\" .%A A. Harkin
195ea45dd54Sdlg.\" .%D March 1995
196ea45dd54Sdlg.\" .%R RFC 1784
197ea45dd54Sdlg.\" .%T TFTP Timeout Interval and Transfer Size Options
198ea45dd54Sdlg.\" .Re
199ea45dd54Sdlg.\" .Pp
200ea45dd54Sdlg.Rs
201ea45dd54Sdlg.%A G. Malkin
202ea45dd54Sdlg.%A A. Harkin
203ea45dd54Sdlg.%D May 1998
204ea45dd54Sdlg.%R RFC 2347
205ea45dd54Sdlg.%T TFTP Option Extension
206ea45dd54Sdlg.Re
207ea45dd54Sdlg.Pp
208ea45dd54Sdlg.Rs
209ea45dd54Sdlg.%A G. Malkin
210ea45dd54Sdlg.%A A. Harkin
211ea45dd54Sdlg.%D May 1998
212ea45dd54Sdlg.%R RFC 2348
213ea45dd54Sdlg.%T TFTP Blocksize Option
214ea45dd54Sdlg.Re
215ea45dd54Sdlg.Pp
216ea45dd54Sdlg.Rs
217ea45dd54Sdlg.%A G. Malkin
218ea45dd54Sdlg.%A A. Harkin
219ea45dd54Sdlg.%D March 1998
220ea45dd54Sdlg.%R RFC 2349
221ea45dd54Sdlg.%T TFTP Timeout Interval and Transfer Size Options
222ea45dd54Sdlg.Re
2238871c557Sdlg.Sh HISTORY
2248871c557SdlgThe
2258871c557Sdlg.Nm
2268871c557Sdlgcommand was originally a process run via
2278871c557Sdlg.Xr inetd 8
2288871c557Sdlgand appeared in
2298871c557Sdlg.Bx 4.2 .
2308871c557SdlgIt was rewritten for
2318871c557Sdlg.Ox 5.2
2328871c557Sdlgas a persistent non-blocking daemon.
2338871c557Sdlg.Sh BUGS
2348871c557SdlgMany TFTP clients will not transfer files over 16744448 octets
2358871c557Sdlg.Pq 32767 blocks .
236