xref: /openbsd/usr.sbin/tftpd/tftpd.8 (revision d89ec533)
1.\"   $OpenBSD: tftpd.8,v 1.8 2019/03/04 01:06:03 dlg 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: March 4 2019 $
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 46cdiv
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.
56Files may be written only if they already exist and are publicly writable,
57unless the
58.Fl c
59flag is specified
60.Pq see below .
61Note that this extends the concept of
62.Dq public
63to include
64all users on all hosts that can be reached through the network;
65this may not be appropriate on all systems, and its implications
66should be considered before enabling TFTP service.
67.Pp
68The server must be started as root, but will chroot to the
69.Ar directory
70specified on the command line and drop privileges to the _tftpd user.
71.Pp
72.Nm tftpd
73always provides random data at the path
74.Pa /etc/random.seed ,
75and therefore this path will be ignored inside the
76.Ar directory .
77.Ox
78network bootloaders access this path to harvest entropy during
79kernel load.
80.Pp
81The options are as follows:
82.Bl -tag -width Ds
83.It Fl 4
84Forces
85.Nm
86to use IPv4 addresses only.
87.It Fl 6
88Forces
89.Nm
90to use IPv6 addresses only.
91.It Fl c
92Allow new files to be created;
93otherwise uploaded files must already exist.
94Files are created with default permissions
95allowing anyone to read or write to them.
96.It Fl d
97Do not daemonize.
98If this option is specified,
99.Nm
100will run in the foreground and log
101the client IP, type of request, and filename to stderr.
102.It Fl i
103Look up the requested path in the subdirectory named after the
104client's IP address.
105For read requests, if the file is not found,
106.Nm
107falls back on the requested path.
108Note that no attempt is made to limit the client to its subdirectory.
109This option cannot be combined with
110.Fl r .
111.It Fl l Ar address
112Listen on the specified address.
113By default
114.Nm
115listens on wildcard addresses.
116.It Fl p Ar port
117Listen on the specified port.
118By default
119.Nm
120listens on the port indicated in the
121.Ql tftp
122service description; see
123.Xr services 5 .
124.It Fl r Ar socket
125Issue filename rewrite requests to the specified UNIX domain socket.
126.Nm
127will write lines in the format "IP OP filename", terminated by a newline,
128where IP is the client's IP address, and OP is one of "read" or "write".
129.Nm
130expects replies in the format "filename" terminated by a newline.
131All rewrite requests from the daemon must be answered
132(even if it is with the original filename)
133before the TFTP request will continue.
134By default
135.Nm
136does not use filename rewriting.
137This option cannot be combined with
138.Fl i .
139.It Fl v
140Log the client IP, type of request, and filename.
141.It Ar directory
142.Xr chroot 2
143to
144.Ar directory
145on startup;
146the remote host is not expected to pass the directory
147as part of the file name to transfer.
148.El
149.Sh SEE ALSO
150.Xr tftp 1 ,
151.Xr pxeboot 8 ,
152.Xr syslogd 8 ,
153.Xr tftp-proxy 8
154.Sh STANDARDS
155.\" .Rs
156.\" .%A K. R. Sollins
157.\" .%D June 1981
158.\" .%R RFC 783
159.\" .%T The TFTP Protocol (Revision 2)
160.\" .Re
161.\" .Pp
162.Rs
163.%A K. Sollins
164.%D July 1992
165.%R RFC 1350
166.%T The TFTP Protocol (Revision 2)
167.Re
168.Pp
169.\" .Rs
170.\" .%A G. Malkin
171.\" .%A A. Harkin
172.\" .%D March 1995
173.\" .%R RFC 1782
174.\" .%T TFTP Option Extension
175.\" .Re
176.\" .Pp
177.\" .Rs
178.\" .%A G. Malkin
179.\" .%A A. Harkin
180.\" .%D March 1995
181.\" .%R RFC 1783
182.\" .%T TFTP Blocksize Option
183.\" .Re
184.\" .Pp
185.\" .Rs
186.\" .%A G. Malkin
187.\" .%A A. Harkin
188.\" .%D March 1995
189.\" .%R RFC 1784
190.\" .%T TFTP Timeout Interval and Transfer Size Options
191.\" .Re
192.\" .Pp
193.Rs
194.%A G. Malkin
195.%A A. Harkin
196.%D May 1998
197.%R RFC 2347
198.%T TFTP Option Extension
199.Re
200.Pp
201.Rs
202.%A G. Malkin
203.%A A. Harkin
204.%D May 1998
205.%R RFC 2348
206.%T TFTP Blocksize Option
207.Re
208.Pp
209.Rs
210.%A G. Malkin
211.%A A. Harkin
212.%D March 1998
213.%R RFC 2349
214.%T TFTP Timeout Interval and Transfer Size Options
215.Re
216.Sh HISTORY
217The
218.Nm
219command was originally a process run via
220.Xr inetd 8
221and appeared in
222.Bx 4.2 .
223It was rewritten for
224.Ox 5.2
225as a persistent non-blocking daemon.
226.Sh BUGS
227Many TFTP clients will not transfer files over 16744448 octets
228.Pq 32767 blocks .
229