xref: /openbsd/usr.sbin/tftpd/tftpd.8 (revision 4bdff4be)
1.\"   $OpenBSD: tftpd.8,v 1.10 2022/10/05 05:40:16 jmc Exp $
2.\"
3.\" Copyright (c) 1983, 1991 The Regents of the University of California.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	from: @(#)tftpd.8	6.7 (Berkeley) 5/13/91
31.\"
32.Dd $Mdocdate: October 5 2022 $
33.Dt TFTPD 8
34.Os
35.Sh NAME
36.Nm tftpd
37.Nd Trivial File Transfer Protocol daemon
38.Sh SYNOPSIS
39.Nm tftpd
40.Op Fl 46cdivw
41.Op Fl l Ar address
42.Op Fl p Ar port
43.Op Fl r Ar socket
44.Ar directory
45.Sh DESCRIPTION
46.Nm
47is a server which implements the
48Trivial File Transfer Protocol.
49.Pp
50The use of
51.Xr tftp 1
52does not require an account or password on the remote system.
53Due to the lack of authentication information,
54.Nm
55will allow only publicly readable files to be accessed.
56By default files may only be read, unless the
57.Fl w
58option is specified.
59Files may be written only if they already exist and are publicly writable,
60unless the
61.Fl c
62flag is specified.
63Note that this extends the concept of
64.Dq public
65to include
66all users on all hosts that can be reached through the network;
67this may not be appropriate on all systems, and its implications
68should be considered before enabling TFTP service.
69.Pp
70The server must be started as root, but will chroot to the
71.Ar directory
72specified on the command line and drop privileges to the _tftpd user.
73.Pp
74.Nm tftpd
75always provides random data at the path
76.Pa /etc/random.seed ,
77and therefore this path will be ignored inside the
78.Ar directory .
79.Ox
80network bootloaders access this path to harvest entropy during
81kernel load.
82.Pp
83The options are as follows:
84.Bl -tag -width Ds
85.It Fl 4
86Forces
87.Nm
88to use IPv4 addresses only.
89.It Fl 6
90Forces
91.Nm
92to use IPv6 addresses only.
93.It Fl c
94Allow new files to be created;
95otherwise uploaded files must already exist.
96Files are created with default permissions
97allowing anyone to read or write to them.
98.Pp
99This option implies
100.Fl w .
101.It Fl d
102Do not daemonize.
103If this option is specified,
104.Nm
105will run in the foreground and log
106the client IP, type of request, and filename to stderr.
107.It Fl i
108Look up the requested path in the subdirectory named after the
109client's IP address.
110For read requests, if the file is not found,
111.Nm
112falls back on the requested path.
113Note that no attempt is made to limit the client to its subdirectory.
114This option cannot be combined with
115.Fl r .
116.It Fl l Ar address
117Listen on the specified address.
118By default
119.Nm
120listens on wildcard addresses.
121.It Fl p Ar port
122Listen on the specified port.
123By default
124.Nm
125listens on the port indicated in the
126.Ql tftp
127service description; see
128.Xr services 5 .
129.It Fl r Ar socket
130Issue filename rewrite requests to the specified UNIX domain socket.
131.Nm
132will write lines in the format "IP OP filename", terminated by a newline,
133where IP is the client's IP address, and OP is one of "read" or "write".
134.Nm
135expects replies in the format "filename" terminated by a newline.
136All rewrite requests from the daemon must be answered
137(even if it is with the original filename)
138before the TFTP request will continue.
139By default
140.Nm
141does not use filename rewriting.
142This option cannot be combined with
143.Fl i .
144.It Fl v
145Log the client IP, type of request, and filename.
146.It Fl w
147Allow files to be written to.
148.It Ar directory
149.Xr chroot 2
150to
151.Ar directory
152on startup;
153the remote host is not expected to pass the directory
154as part of the file name to transfer.
155.El
156.Sh SEE ALSO
157.Xr tftp 1 ,
158.Xr pxeboot 8 ,
159.Xr syslogd 8 ,
160.Xr tftp-proxy 8
161.Sh STANDARDS
162.\" .Rs
163.\" .%A K. R. Sollins
164.\" .%D June 1981
165.\" .%R RFC 783
166.\" .%T The TFTP Protocol (Revision 2)
167.\" .Re
168.\" .Pp
169.Rs
170.%A K. Sollins
171.%D July 1992
172.%R RFC 1350
173.%T The TFTP Protocol (Revision 2)
174.Re
175.Pp
176.\" .Rs
177.\" .%A G. Malkin
178.\" .%A A. Harkin
179.\" .%D March 1995
180.\" .%R RFC 1782
181.\" .%T TFTP Option Extension
182.\" .Re
183.\" .Pp
184.\" .Rs
185.\" .%A G. Malkin
186.\" .%A A. Harkin
187.\" .%D March 1995
188.\" .%R RFC 1783
189.\" .%T TFTP Blocksize Option
190.\" .Re
191.\" .Pp
192.\" .Rs
193.\" .%A G. Malkin
194.\" .%A A. Harkin
195.\" .%D March 1995
196.\" .%R RFC 1784
197.\" .%T TFTP Timeout Interval and Transfer Size Options
198.\" .Re
199.\" .Pp
200.Rs
201.%A G. Malkin
202.%A A. Harkin
203.%D May 1998
204.%R RFC 2347
205.%T TFTP Option Extension
206.Re
207.Pp
208.Rs
209.%A G. Malkin
210.%A A. Harkin
211.%D May 1998
212.%R RFC 2348
213.%T TFTP Blocksize Option
214.Re
215.Pp
216.Rs
217.%A G. Malkin
218.%A A. Harkin
219.%D March 1998
220.%R RFC 2349
221.%T TFTP Timeout Interval and Transfer Size Options
222.Re
223.Sh HISTORY
224The
225.Nm
226command was originally a process run via
227.Xr inetd 8
228and appeared in
229.Bx 4.2 .
230It was rewritten for
231.Ox 5.2
232as a persistent non-blocking daemon.
233.Sh BUGS
234Many TFTP clients will not transfer files over 16744448 octets
235.Pq 32767 blocks .
236