xref: /freebsd/usr.bin/tftp/tftp.1 (revision 2008043f386721d58158e37e0d7e50df8095942d)
1.\" Copyright (c) 1990, 1993, 1994
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     @(#)tftp.1	8.2 (Berkeley) 4/18/94
29.\"
30.Dd March 2, 2020
31.Dt TFTP 1
32.Os
33.Sh NAME
34.Nm tftp
35.Nd trivial file transfer program
36.Sh SYNOPSIS
37.Nm
38.Op Ar host Op Ar port
39.Sh DESCRIPTION
40The
41.Nm
42utility is the user interface to the Internet
43.Tn TFTP
44(Trivial File Transfer Protocol),
45which allows users to transfer files to and from a remote machine.
46The remote
47.Ar host
48may be specified on the command line, in which case
49.Nm
50uses
51.Ar host
52as the default host for future transfers (see the
53.Cm connect
54command below).
55.Sh COMMANDS
56Once
57.Nm
58is running, it issues the prompt
59.Dq Li tftp>
60and recognizes the following commands:
61.Pp
62.Bl -tag -width verbose -compact
63.It Cm \&? Ar command-name ...
64Print help information.
65.Pp
66.It Cm ascii
67Shorthand for "mode ascii"
68.Pp
69.It Cm binary
70Shorthand for "mode binary"
71.Pp
72.It Cm blocksize Ar [size]
73Sets the TFTP blksize option in TFTP Read Request or Write Request packets
74to
75.Ar [size]
76as specified in RFC 2348.
77Valid values are between 8 and 65464.
78If no blocksize is specified, then by default a blocksize of 512 bytes
79will be used.
80.Pp
81.It Cm blocksize2 Ar [size]
82Sets the TFTP blksize2 option in TFTP Read Request or Write Request packets
83to
84.Ar [size] .
85Values are restricted to powers of 2 between 8 and 32768.
86This is a non-standard TFTP option.
87.Pp
88.It Cm connect Ar host Op Ar port
89Set the
90.Ar host
91(and optionally
92.Ar port )
93for transfers.
94Note that the
95.Tn TFTP
96protocol, unlike the
97.Tn FTP
98protocol,
99does not maintain connections between transfers; thus, the
100.Cm connect
101command does not actually create a connection,
102but merely remembers what host is to be used for transfers.
103You do not have to use the
104.Cm connect
105command; the remote host can be specified as part of the
106.Cm get
107or
108.Cm put
109commands.
110.Pp
111.It Cm debug Ar level
112Enable or disable debugging levels during verbose output.
113The value of
114.Ar level
115can be one of
116.Cm packet , simple , options ,
117or
118.Cm access .
119.Pp
120.It Cm get Oo Ar host : Oc Ns Ar file Op Ar localname
121.It Cm get Xo
122.Oo Ar host1 : Oc Ns Ar file1
123.Oo Ar host2 : Oc Ns Ar file2 ...
124.Oo Ar hostN : Oc Ns Ar fileN
125.Xc
126Get one or more files from the remote host.
127When using the
128.Ar host
129argument, the
130.Ar host
131will be used as default host for future transfers.
132If
133.Ar localname
134is specified, the file is stored locally as
135.Ar localname ,
136otherwise the original filename is used.
137Note that it is not possible to download two files at a time, only
138one, three, or more than three files, at a time.
139.Pp
140To specify an IPv6 numeric address for a host, wrap it using square
141brackets like
142.Dq Li [3ffe:2900:e00c:ffee::1234] : Ns Ar file
143to disambiguate the
144colons used in the IPv6 address from the colon separating the host and
145the filename.
146.Pp
147.It Cm mode Ar transfer-mode
148Set the mode for transfers;
149.Ar transfer-mode
150may be one of
151.Em ascii
152or
153.Em binary .
154The default is
155.Em binary .
156.Pp
157.It Cm packetdrop [arg]
158Randomly drop
159.Ar arg
160out of 100 packets during a transfer.
161This is a debugging feature.
162.Pp
163.It Cm put Ar file Op Oo Ar host : Oc Ns Ar remotename
164.It Cm put Ar file1 file2 ... fileN Op Oo Ar host : Oc Ns Ar remote-directory
165Put a file or set of files to the remote host.
166When
167.Ar remotename
168is specified, the file is stored remotely as
169.Ar remotename ,
170otherwise the original filename is used.
171If the
172.Ar remote-directory
173argument is used, the remote host is assumed to be a
174.Ux
175machine.
176To specify an IPv6 numeric address for a
177.Ar host ,
178see the example under the
179.Cm get
180command.
181.Pp
182.It Cm options Ar [arg]
183Enable or disable support for TFTP options.
184The valid values of
185.Ar arg
186are
187.Cm on
188(enable RFC 2347 options),
189.Cm off
190(disable RFC 2347 options), and
191.Cm extra
192(toggle support for non-RFC defined options).
193.Pp
194.It Cm quit
195Exit
196.Nm .
197An end of file also exits.
198.Pp
199.It Cm rexmt Ar retransmission-timeout
200Set the per-packet retransmission timeout, in seconds.
201.Pp
202.It Cm rollover [arg]
203Specify the rollover option in TFTP Read Request or Write
204Request packets.
205After 65535 packets have been transmitted, set the block counter to
206.Ar arg .
207Valid values of
208.Ar arg
209are 0 and 1.  This is a non-standard TFTP option.
210.Pp
211.It Cm status
212Show current status.
213.Pp
214.It Cm timeout Ar total-transmission-timeout
215Set the total transmission timeout, in seconds.
216.Pp
217.It Cm trace
218Toggle packet tracing.
219.Pp
220.It Cm verbose
221Toggle verbose mode.
222.Pp
223.It Cm windowsize Op Ar size
224Sets the TFTP windowsize option in TFTP Read Request or Write Request packets to
225.Op Ar size
226blocks as specified in RFC 7440.
227Valid values are between 1 and 65535.
228If no windowsize is specified,
229then the default windowsize of 1 block will be used.
230.El
231.Sh SEE ALSO
232.Xr tftpd 8
233.Pp
234The following RFC's are supported:
235.Rs
236.%T RFC 1350: The TFTP Protocol (Revision 2)
237.Re
238.Rs
239.%T RFC 2347: TFTP Option Extension
240.Re
241.Rs
242.%T RFC 2348: TFTP Blocksize Option
243.Re
244.Rs
245.%T RFC 2349: TFTP Timeout Interval and Transfer Size Options
246.Re
247.Rs
248.%T RFC 3617: Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP)
249.Re
250.Rs
251.%T RFC 7440: TFTP Windowsize Option
252.Re
253.Pp
254The non-standard
255.Cm rollover
256and
257.Cm blksize2
258TFTP options are mentioned here:
259.Rs
260.%T Extending TFTP
261.%U https://www.compuphase.com/tftp.htm
262.Re
263.Sh HISTORY
264The
265.Nm
266command appeared in
267.Bx 4.3 .
268.Pp
269Edwin Groothuis <edwin@FreeBSD.org> performed a major rewrite of the
270.Xr tftpd 8
271and
272.Nm
273code to support RFC2348.
274.Sh NOTES
275Because there is no user-login or validation within
276the
277.Tn TFTP
278protocol, the remote site will probably have some
279sort of file-access restrictions in place.
280The
281exact methods are specific to each site and therefore
282difficult to document here.
283.Pp
284Files larger than 33488896 octets (65535 blocks) cannot be transferred
285without client and server supporting the TFTP blocksize option (RFC2348),
286or the non-standard TFTP rollover option.
287