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