Annotation of src/usr.bin/ftp/ftp.1, Revision 1.84
1.84 ! lteo 1: .\" $OpenBSD: ftp.1,v 1.83 2012/08/14 20:47:08 haesbaert Exp $
1.14 millert 2: .\" $NetBSD: ftp.1,v 1.22 1997/08/18 10:20:22 lukem Exp $
1.1 deraadt 3: .\"
4: .\" Copyright (c) 1985, 1989, 1990, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" Redistribution and use in source and binary forms, with or without
8: .\" modification, are permitted provided that the following conditions
9: .\" are met:
10: .\" 1. Redistributions of source code must retain the above copyright
11: .\" notice, this list of conditions and the following disclaimer.
12: .\" 2. Redistributions in binary form must reproduce the above copyright
13: .\" notice, this list of conditions and the following disclaimer in the
14: .\" documentation and/or other materials provided with the distribution.
1.39 millert 15: .\" 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 16: .\" may be used to endorse or promote products derived from this software
17: .\" without specific prior written permission.
18: .\"
19: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29: .\" SUCH DAMAGE.
30: .\"
31: .\" @(#)ftp.1 8.3 (Berkeley) 10/9/94
32: .\"
1.84 ! lteo 33: .Dd $Mdocdate: August 14 2012 $
1.1 deraadt 34: .Dt FTP 1
1.25 aaron 35: .Os
1.1 deraadt 36: .Sh NAME
37: .Nm ftp
1.42 jmc 38: .Nd ARPANET file transfer program
1.1 deraadt 39: .Sh SYNOPSIS
1.23 aaron 40: .Nm ftp
1.65 jmc 41: .Op Fl 46AadEegimnptVv
1.61 espie 42: .Op Fl k Ar seconds
1.6 millert 43: .Op Fl P Ar port
1.7 millert 44: .Op Fl r Ar seconds
1.82 haesbaer 45: .Op Fl s Ar srcaddr
1.6 millert 46: .Op Ar host Op Ar port
1.3 deraadt 47: .Nm ftp
1.65 jmc 48: .Op Fl C
1.42 jmc 49: .Op Fl o Ar output
1.82 haesbaer 50: .Op Fl s Ar srcaddr
1.42 jmc 51: .Sm off
52: .No ftp:// Oo Ar user : password No @
53: .Oc Ar host Oo : Ar port
54: .Oc No / Ar file Oo /
55: .Oc
1.81 jmc 56: .Sm on
1.77 martynas 57: .Ar ...
1.3 deraadt 58: .Nm ftp
1.65 jmc 59: .Op Fl C
60: .Op Fl c Ar cookie
1.42 jmc 61: .Op Fl o Ar output
1.82 haesbaer 62: .Op Fl s Ar srcaddr
1.42 jmc 63: .Sm off
1.84 ! lteo 64: .No http[s]:// Oo Ar user : password No @
1.83 haesbaer 65: .Oc Ar host Oo : Ar port
1.54 deraadt 66: .Oc No / Ar file
1.81 jmc 67: .Sm on
1.77 martynas 68: .Ar ...
1.54 deraadt 69: .Nm ftp
1.65 jmc 70: .Op Fl C
1.54 deraadt 71: .Op Fl o Ar output
1.82 haesbaer 72: .Op Fl s Ar srcaddr
1.54 deraadt 73: .Sm off
1.81 jmc 74: .No file: Ar file
1.78 sobrado 75: .Sm on
1.81 jmc 76: .Ar ...
1.78 sobrado 77: .Nm ftp
78: .Op Fl C
79: .Op Fl o Ar output
1.82 haesbaer 80: .Op Fl s Ar srcaddr
1.78 sobrado 81: .Sm off
1.42 jmc 82: .Ar host : No / Ar file Oo /
83: .Oc
1.81 jmc 84: .Sm on
1.77 martynas 85: .Ar ...
1.1 deraadt 86: .Sh DESCRIPTION
1.27 aaron 87: .Nm
1.1 deraadt 88: is the user interface to the
89: .Tn ARPANET
1.48 jmc 90: standard File Transfer Protocol (FTP).
1.1 deraadt 91: The program allows a user to transfer files to and from a
92: remote network site.
1.3 deraadt 93: .Pp
1.84 ! lteo 94: The latter four usage formats will fetch a file using either the
1.55 jmc 95: FTP, HTTP, or HTTPS protocols into the current directory.
1.29 aaron 96: This is ideal for scripts.
97: Refer to
1.9 millert 98: .Sx AUTO-FETCHING FILES
99: below for more information.
1.7 millert 100: .Pp
1.28 aaron 101: The options are as follows:
1.32 aaron 102: .Bl -tag -width Ds
1.42 jmc 103: .It Fl 4
104: Forces
105: .Nm
106: to use IPv4 addresses only.
107: .It Fl 6
108: Forces
109: .Nm
110: to use IPv6 addresses only.
1.16 millert 111: .It Fl A
1.48 jmc 112: Force active mode FTP.
1.29 aaron 113: By default,
1.16 millert 114: .Nm
1.48 jmc 115: will try to use passive mode FTP and fall back to active mode
1.29 aaron 116: if passive is not supported by the server.
117: This option causes
1.16 millert 118: .Nm
1.29 aaron 119: to always use an active connection.
120: It is only useful for connecting
1.16 millert 121: to very old servers that do not implement passive mode properly.
1.6 millert 122: .It Fl a
123: Causes
124: .Nm
1.22 aaron 125: to bypass the normal login procedure and use an anonymous login instead.
1.63 martynas 126: .It Fl C
1.65 jmc 127: Continue a previously interrupted file transfer.
1.64 jmc 128: .Nm
129: will continue transferring from an offset equal to the length of
130: .Ar file .
1.65 jmc 131: .Pp
1.64 jmc 132: Resuming HTTP(S) transfers are only supported
133: if the remote server supports the
134: .Dq Range
135: header.
1.60 jmc 136: .It Fl c Ar cookie
137: Load a Netscape-like cookiejar file
138: for HTTP and HTTPS transfers.
1.59 pyr 139: With this option relevant cookies from the jar are sent with each HTTP(S)
140: request.
1.60 jmc 141: Setting the
142: .Ev http_cookies
143: environment variable has the same effect.
144: If both the
145: .Ev http_cookies
146: environment variable is set and the
1.59 pyr 147: .Fl c
1.60 jmc 148: argument is given, the latter takes precedence.
1.6 millert 149: .It Fl d
150: Enables debugging.
1.53 fgsch 151: .It Fl E
152: Disables EPSV/EPRT command on IPv4 connections.
1.8 kstailey 153: .It Fl e
1.29 aaron 154: Disables command line editing.
155: Useful for Emacs ange-ftp.
1.6 millert 156: .It Fl g
157: Disables file name globbing.
158: .It Fl i
159: Turns off interactive prompting during
160: multiple file transfers.
1.61 espie 161: .It Fl k Ar seconds
1.67 jmc 162: When greater than zero,
1.66 espie 163: sends a byte after each
1.61 espie 164: .Ar seconds
165: period over the control connection during long transfers,
166: so that incorrectly configured network equipment won't
1.62 jmc 167: aggressively drop it.
1.61 espie 168: The FTP protocol supports a
169: .Dv NOOP
170: command that can be used for that purpose.
171: This assumes the FTP server can deal with extra commands coming over
172: the control connection during a transfer.
173: Well-behaved servers queue those commands, and process them after the
174: transfer.
1.68 espie 175: By default,
176: .Nm
177: will send a byte every 60 seconds.
1.20 millert 178: .It Fl m
179: Causes
180: .Nm
1.21 millert 181: to always display the progress meter in cases where it would not do
182: so by default.
1.1 deraadt 183: .It Fl n
184: Restrains
1.6 millert 185: .Nm
186: from attempting
187: .Dq auto-login
188: upon initial connection.
1.1 deraadt 189: If auto-login is enabled,
1.6 millert 190: .Nm
1.1 deraadt 191: will check the
192: .Pa .netrc
1.42 jmc 193: file (see below) in the user's home directory for an entry describing
1.1 deraadt 194: an account on the remote machine.
195: If no entry exists,
1.6 millert 196: .Nm
1.1 deraadt 197: will prompt for the remote machine login name (default is the user
198: identity on the local machine), and, if necessary, prompt for a password
1.47 jmc 199: and an account with which to log in.
1.17 millert 200: .It Fl o Ar output
1.42 jmc 201: When fetching a single file or URL, save the contents in
1.17 millert 202: .Ar output .
1.22 aaron 203: To make the contents go to stdout,
1.17 millert 204: use
1.48 jmc 205: .Sq -
1.17 millert 206: for
207: .Ar output .
1.42 jmc 208: .It Fl P Ar port
209: Sets the port number to
210: .Ar port .
1.6 millert 211: .It Fl p
212: Enable passive mode operation for use behind connection filtering firewalls.
1.16 millert 213: This option has been deprecated as
214: .Nm
215: now tries to use passive mode by default, falling back to active mode
216: if the server does not support passive connections.
1.42 jmc 217: .It Fl r Ar seconds
218: Retry to connect if failed, pausing for number of
219: .Ar seconds .
1.82 haesbaer 220: .It Fl s Ar srcaddr
221: Use
222: .Ar srcaddr
223: on the local machine as the source address
224: of the connection.
225: Only useful on systems with more than one address.
1.6 millert 226: .It Fl t
227: Enables packet tracing.
1.42 jmc 228: .It Fl V
229: Disable verbose mode, overriding the default of enabled when input
230: is from a terminal.
1.6 millert 231: .It Fl v
232: Enable verbose mode.
233: This is the default if input is from a terminal.
234: Forces
235: .Nm
236: to show all responses from the remote server, as well
237: as report on data transfer statistics.
1.1 deraadt 238: .El
239: .Pp
1.43 jmc 240: The host with which
1.6 millert 241: .Nm
1.1 deraadt 242: is to communicate may be specified on the command line.
243: If this is done,
1.6 millert 244: .Nm
1.1 deraadt 245: will immediately attempt to establish a connection to an
1.48 jmc 246: FTP server on that host; otherwise,
1.6 millert 247: .Nm
1.1 deraadt 248: will enter its command interpreter and await instructions
249: from the user.
250: When
1.6 millert 251: .Nm
1.42 jmc 252: is awaiting commands, the prompt
1.51 jmc 253: .Dq ftp\*(Gt
1.1 deraadt 254: is provided to the user.
255: The following commands are recognized
256: by
1.48 jmc 257: .Nm :
1.1 deraadt 258: .Bl -tag -width Fl
1.73 sobrado 259: .It Ic \&! Oo Ar command
260: .Op Ar arg ...
261: .Oc
1.1 deraadt 262: Invoke an interactive shell on the local machine.
263: If there are arguments, the first is taken to be a command to execute
264: directly, with the rest of the arguments as its arguments.
1.73 sobrado 265: .It Ic \&$ Ar macro-name Op Ar arg ...
1.1 deraadt 266: Execute the macro
267: .Ar macro-name
268: that was defined with the
269: .Ic macdef
270: command.
271: Arguments are passed to the macro unglobbed.
1.42 jmc 272: .It Ic \&? Op Ar command
273: A synonym for
274: .Ic help .
1.73 sobrado 275: .It Ic account Op Ar password
1.1 deraadt 276: Supply a supplemental password required by a remote system for access
277: to resources once a login has been successfully completed.
278: If no argument is included, the user will be prompted for an account
279: password in a non-echoing input mode.
280: .It Ic append Ar local-file Op Ar remote-file
281: Append a local file to a file on the remote machine.
282: If
283: .Ar remote-file
284: is left unspecified, the local file name is used in naming the
285: remote file after being altered by any
286: .Ic ntrans
287: or
288: .Ic nmap
289: setting.
290: File transfer uses the current settings for
1.29 aaron 291: .Ic type ,
1.1 deraadt 292: .Ic format ,
1.29 aaron 293: .Ic mode ,
1.1 deraadt 294: and
295: .Ic structure .
296: .It Ic ascii
297: Set the file transfer
298: .Ic type
299: to network
300: .Tn ASCII .
1.73 sobrado 301: .It Ic bell Op Ic on | off
1.1 deraadt 302: Arrange that a bell be sounded after each file transfer
303: command is completed.
304: .It Ic binary
305: Set the file transfer
306: .Ic type
307: to support binary image transfer.
1.73 sobrado 308: This is the default type.
1.1 deraadt 309: .It Ic bye
1.48 jmc 310: Terminate the FTP session with the remote server and exit
311: .Nm .
1.22 aaron 312: An end-of-file will also terminate the session and exit.
1.73 sobrado 313: .It Ic case Op Ic on | off
1.1 deraadt 314: Toggle remote computer file name case mapping during
315: .Ic mget
316: commands.
317: When
318: .Ic case
319: is on (default is off), remote computer file names with all letters in
320: upper case are written in the local directory with the letters mapped
321: to lower case.
1.42 jmc 322: .It Ic cd Ar remote-directory
1.1 deraadt 323: Change the working directory on the remote machine
324: to
1.6 millert 325: .Ar remote-directory .
1.1 deraadt 326: .It Ic cdup
327: Change the remote machine working directory to the parent of the
328: current remote machine working directory.
1.73 sobrado 329: .It Ic chmod Ar mode file
330: Change the permission modes of
331: .Ar file
1.1 deraadt 332: on the remote
1.6 millert 333: system to
334: .Ar mode .
1.1 deraadt 335: .It Ic close
1.48 jmc 336: Terminate the FTP session with the remote server and
1.1 deraadt 337: return to the command interpreter.
338: Any defined macros are erased.
1.73 sobrado 339: .It Ic cr Op Ic on | off
1.1 deraadt 340: Toggle carriage return stripping during
1.22 aaron 341: ASCII type file retrieval.
1.1 deraadt 342: Records are denoted by a carriage return/linefeed sequence
1.22 aaron 343: during ASCII type file transfer.
1.1 deraadt 344: When
1.42 jmc 345: .Ic cr
1.1 deraadt 346: is on (the default), carriage returns are stripped from this
347: sequence to conform with the
348: .Ux
1.42 jmc 349: single linefeed record delimiter.
350: Records on non-UNIX
1.1 deraadt 351: remote systems may contain single linefeeds;
1.22 aaron 352: when an ASCII type transfer is made, these linefeeds may be
1.1 deraadt 353: distinguished from a record delimiter only when
1.42 jmc 354: .Ic cr
1.1 deraadt 355: is off.
1.73 sobrado 356: .It Ic debug Oo Ic on | off |
357: .Ar debuglevel
358: .Oc
1.1 deraadt 359: Toggle debugging mode.
360: If an optional
1.73 sobrado 361: .Ar debuglevel
1.42 jmc 362: is specified, it is used to set the debugging level.
1.1 deraadt 363: When debugging is on,
1.6 millert 364: .Nm
1.7 millert 365: prints each command sent to the remote machine,
366: preceded by the string
1.51 jmc 367: .Ql --\*(Gt .
1.42 jmc 368: .It Ic delete Ar remote-file
369: Delete the file
370: .Ar remote-file
371: on the remote machine.
1.6 millert 372: .It Ic dir Op Ar remote-directory Op Ar local-file
1.30 millert 373: A synonym for
374: .Ic ls .
1.1 deraadt 375: .It Ic disconnect
376: A synonym for
1.6 millert 377: .Ic close .
1.73 sobrado 378: .It Ic edit Op Ic on | off
1.6 millert 379: Toggle command line editing, and context sensitive command and file
380: completion.
381: This is automatically enabled if input is from a terminal, and
382: disabled otherwise.
1.73 sobrado 383: .It Ic epsv4 Op Ic on | off
1.31 itojun 384: Toggle use of EPSV/EPRT command on IPv4 connection.
1.6 millert 385: .It Ic exit
386: A synonym for
387: .Ic bye .
1.1 deraadt 388: .It Ic form Ar format
389: Set the file transfer
390: .Ic form
391: to
1.6 millert 392: .Ar format .
1.42 jmc 393: The default format is
394: .Dq file .
395: .It Ic ftp Ar host Op Ar port
396: A synonym for
397: .Ic open .
1.73 sobrado 398: .It Ic gate Oo Ic on | off |
399: .Ar host Op Ar port
400: .Oc
1.42 jmc 401: Toggle gate-ftp mode.
402: This will not be permitted if the gate-ftp server hasn't been set
403: (either explicitly by the user, or from the
404: .Ev FTPSERVER
405: environment variable).
406: If
407: .Ar host
408: is given,
409: then gate-ftp mode will be enabled, and the gate-ftp server will be set to
410: .Ar host .
411: If
412: .Ar port
413: is also given, that will be used as the port to connect to on the
414: gate-ftp server.
1.1 deraadt 415: .It Ic get Ar remote-file Op Ar local-file
416: Retrieve the
417: .Ar remote-file
418: and store it on the local machine.
419: If the local
420: file name is not specified, it is given the same
421: name it has on the remote machine, subject to
422: alteration by the current
1.29 aaron 423: .Ic case ,
1.1 deraadt 424: .Ic ntrans ,
425: and
426: .Ic nmap
427: settings.
428: The current settings for
1.29 aaron 429: .Ic type ,
1.1 deraadt 430: .Ic form ,
1.29 aaron 431: .Ic mode ,
1.1 deraadt 432: and
433: .Ic structure
434: are used while transferring the file.
1.73 sobrado 435: .It Ic glob Op Ic on | off
1.1 deraadt 436: Toggle filename expansion for
1.29 aaron 437: .Ic mdelete ,
1.1 deraadt 438: .Ic mget
439: and
1.6 millert 440: .Ic mput .
1.1 deraadt 441: If globbing is turned off with
1.29 aaron 442: .Ic glob ,
1.1 deraadt 443: the file name arguments
444: are taken literally and not expanded.
445: Globbing for
446: .Ic mput
447: is done as in
448: .Xr csh 1 .
449: For
450: .Ic mdelete
451: and
1.29 aaron 452: .Ic mget ,
1.1 deraadt 453: each remote file name is expanded
454: separately on the remote machine and the lists are not merged.
455: Expansion of a directory name is likely to be
456: different from expansion of the name of an ordinary file:
1.48 jmc 457: the exact result depends on the foreign operating system and FTP server,
1.1 deraadt 458: and can be previewed by doing
1.42 jmc 459: .Dq mls remote-files - .
1.1 deraadt 460: Note:
461: .Ic mget
462: and
463: .Ic mput
464: are not meant to transfer
465: entire directory subtrees of files.
466: That can be done by
467: transferring a
468: .Xr tar 1
469: archive of the subtree (in binary mode).
1.73 sobrado 470: .It Ic hash Oo Ic on | off |
471: .Ar size
472: .Oc
1.29 aaron 473: Toggle hash mark
474: .Pq Ql #
475: printing for each data block transferred.
1.5 kstailey 476: The size of a data block defaults to 1024 bytes.
1.6 millert 477: This can be changed by specifying
478: .Ar size
479: in bytes.
1.1 deraadt 480: .It Ic help Op Ar command
481: Print an informative message about the meaning of
1.6 millert 482: .Ar command .
1.1 deraadt 483: If no argument is given,
1.6 millert 484: .Nm
1.1 deraadt 485: prints a list of the known commands.
486: .It Ic idle Op Ar seconds
487: Set the inactivity timer on the remote server to
488: .Ar seconds
489: seconds.
490: If
491: .Ar seconds
492: is omitted, the current inactivity timer is printed.
1.73 sobrado 493: .It Ic lcd Op Ar local-directory
1.1 deraadt 494: Change the working directory on the local machine.
495: If
496: no
1.73 sobrado 497: .Ar local-directory
1.1 deraadt 498: is specified, the user's home directory is used.
1.10 millert 499: .It Ic less Ar file
500: A synonym for
501: .Ic page .
1.6 millert 502: .It Ic lpwd
503: Print the working directory on the local machine.
1.42 jmc 504: .It Ic ls Op Ar remote-directory Op Ar local-file
505: Print a listing of the contents of a directory on the remote machine.
1.30 millert 506: The listing includes any system-dependent information that the server
507: chooses to include; for example, most
508: .Ux
1.42 jmc 509: systems will produce output from the command
510: .Ql ls -l .
1.1 deraadt 511: If
512: .Ar remote-directory
513: is left unspecified, the current working directory is used.
514: If interactive prompting is on,
1.6 millert 515: .Nm
1.1 deraadt 516: will prompt the user to verify that the last argument is indeed the
517: target local file for receiving
1.6 millert 518: .Ic ls
1.1 deraadt 519: output.
520: If no local file is specified, or if
521: .Ar local-file
522: is
1.49 jmc 523: .Sq - ,
1.1 deraadt 524: the output is sent to the terminal.
525: .It Ic macdef Ar macro-name
526: Define a macro.
527: Subsequent lines are stored as the macro
1.29 aaron 528: .Ar macro-name ;
1.1 deraadt 529: a null line (consecutive newline characters
530: in a file or
531: carriage returns from the terminal) terminates macro input mode.
532: There is a limit of 16 macros and 4096 total characters in all
533: defined macros.
1.50 jmc 534: Macro names can be a maximum of 8 characters.
535: Macros are only applicable to the current session they are
536: defined in (or if defined outside a session, to the session
537: invoked with the next
538: .Ic open
539: command), and remain defined until a
1.1 deraadt 540: .Ic close
541: command is executed.
1.51 jmc 542: To invoke a macro,
1.52 jmc 543: use the
544: .Ic $
545: command (see above).
1.51 jmc 546: .Pp
1.29 aaron 547: The macro processor interprets
548: .Ql $
549: and
550: .Ql \e
551: as special characters.
552: A
553: .Ql $
554: followed by a number (or numbers) is replaced by the
1.1 deraadt 555: corresponding argument on the macro invocation command line.
1.29 aaron 556: A
557: .Ql $
558: followed by an
559: .Sq i
560: tells the macro processor that the
1.1 deraadt 561: executing macro is to be looped.
1.29 aaron 562: On the first pass
563: .Ql $i
564: is
1.1 deraadt 565: replaced by the first argument on the macro invocation command line,
566: on the second pass it is replaced by the second argument, and so on.
1.29 aaron 567: A
568: .Ql \e
569: followed by any character is replaced by that character.
570: Use the
571: .Ql \e
572: to prevent special treatment of the
573: .Ql $ .
1.1 deraadt 574: .It Ic mdelete Op Ar remote-files
575: Delete the
576: .Ar remote-files
577: on the remote machine.
578: .It Ic mdir Ar remote-files local-file
1.30 millert 579: A synonym for
580: .Ic mls .
1.70 martynas 581: .It Xo Ic mget
1.74 martynas 582: .Op Fl cnr
583: .Op Fl d Ar depth
1.70 martynas 584: .Ar remote-files
585: .Xc
1.1 deraadt 586: Expand the
587: .Ar remote-files
588: on the remote machine
589: and do a
590: .Ic get
591: for each file name thus produced.
592: See
593: .Ic glob
594: for details on the filename expansion.
595: Resulting file names will then be processed according to
1.29 aaron 596: .Ic case ,
1.1 deraadt 597: .Ic ntrans ,
598: and
599: .Ic nmap
600: settings.
601: Files are transferred into the local working directory,
602: which can be changed with
603: .Ql lcd directory ;
604: new local directories can be created with
605: .Ql "\&! mkdir directory" .
1.71 martynas 606: .Pp
1.74 martynas 607: The options are as follows:
608: .Bl -tag -width Ds
609: .It Fl c
610: Use
1.71 martynas 611: .Ic reget
1.74 martynas 612: instead of
1.71 martynas 613: .Ic get .
1.74 martynas 614: .It Fl d Ar depth
615: Specify the maximum recursion level
616: .Ar depth .
617: The default is 0, which means unlimited.
618: .It Fl n
619: Use
620: .Ic newer
621: instead of
622: .Ic get .
623: .It Fl r
624: Recursively descend the directory tree, transferring all files and
625: directories.
626: .El
1.1 deraadt 627: .It Ic mkdir Ar directory-name
628: Make a directory on the remote machine.
629: .It Ic mls Ar remote-files local-file
630: Like
1.29 aaron 631: .Ic ls ,
1.1 deraadt 632: except multiple remote files may be specified,
633: and the
634: .Ar local-file
635: must be specified.
636: If interactive prompting is on,
1.6 millert 637: .Nm
1.1 deraadt 638: will prompt the user to verify that the last argument is indeed the
639: target local file for receiving
640: .Ic mls
641: output.
642: .It Ic mode Op Ar mode-name
643: Set the file transfer
644: .Ic mode
645: to
1.6 millert 646: .Ar mode-name .
1.42 jmc 647: The default mode is
648: .Dq stream
649: mode.
1.73 sobrado 650: .It Ic modtime Ar file
651: Show the last modification time of
652: .Ar file
653: on the remote machine.
1.10 millert 654: .It Ic more Ar file
655: A synonym for
656: .Ic page .
1.70 martynas 657: .It Xo Ic mput
658: .Op Fl c
659: .Ar local-files
660: .Xc
1.1 deraadt 661: Expand wild cards in the list of local files given as arguments
662: and do a
663: .Ic put
664: for each file in the resulting list.
665: See
666: .Ic glob
667: for details of filename expansion.
668: Resulting file names will then be processed according to
669: .Ic ntrans
670: and
671: .Ic nmap
672: settings.
1.71 martynas 673: .Pp
674: If the
675: .Fl c
676: flag is specified then
677: .Ic reput
678: is used instead of
679: .Ic put .
1.73 sobrado 680: .It Xo Ic msend
681: .Op Fl c
682: .Ar local-files
683: .Xc
1.6 millert 684: A synonym for
685: .Ic mput .
1.73 sobrado 686: .It Ic newer Ar remote-file Op Ar local-file
1.1 deraadt 687: Get the file only if the modification time of the remote file is more
1.22 aaron 688: recent than the file on the current system.
1.1 deraadt 689: If the file does not
690: exist on the current system, the remote file is considered
1.6 millert 691: .Ic newer .
1.1 deraadt 692: Otherwise, this command is identical to
1.6 millert 693: .Ar get .
694: .It Ic nlist Op Ar remote-directory Op Ar local-file
1.30 millert 695: Print a list of the files in a
696: directory on the remote machine.
697: If
698: .Ar remote-directory
699: is left unspecified, the current working directory is used.
700: If interactive prompting is on,
701: .Nm
702: will prompt the user to verify that the last argument is indeed the
703: target local file for receiving
704: .Ic nlist
705: output.
706: If no local file is specified, or if
707: .Ar local-file
708: is
1.49 jmc 709: .Sq - ,
1.38 jmc 710: the output is sent to the terminal.
711: Note that on some servers, the
1.30 millert 712: .Ic nlist
713: command will only return information on normal files (not directories
714: or special files).
1.1 deraadt 715: .It Ic nmap Op Ar inpattern outpattern
716: Set or unset the filename mapping mechanism.
717: If no arguments are specified, the filename mapping mechanism is unset.
718: If arguments are specified, remote filenames are mapped during
719: .Ic mput
720: commands and
721: .Ic put
722: commands issued without a specified remote target filename.
723: If arguments are specified, local filenames are mapped during
724: .Ic mget
725: commands and
726: .Ic get
727: commands issued without a specified local target filename.
1.42 jmc 728: This command is useful when connecting to a non-UNIX remote computer
1.1 deraadt 729: with different file naming conventions or practices.
1.42 jmc 730: .Pp
1.1 deraadt 731: The mapping follows the pattern set by
732: .Ar inpattern
733: and
1.6 millert 734: .Ar outpattern .
1.22 aaron 735: .Ar inpattern
1.1 deraadt 736: is a template for incoming filenames (which may have already been
737: processed according to the
738: .Ic ntrans
739: and
740: .Ic case
741: settings).
742: Variable templating is accomplished by including the
1.29 aaron 743: sequences
744: .Ql $1 ,
745: .Ql $2 ,
1.44 jmc 746: \&...,
1.29 aaron 747: .Ql $9
748: in
1.6 millert 749: .Ar inpattern .
1.29 aaron 750: Use
751: .Ql \e
752: to prevent this special treatment of the
753: .Ql $
754: character.
1.1 deraadt 755: All other characters are treated literally, and are used to determine the
756: .Ic nmap
1.22 aaron 757: .Ar inpattern
1.1 deraadt 758: variable values.
1.45 jmc 759: .Pp
1.1 deraadt 760: For example, given
761: .Ar inpattern
762: $1.$2 and the remote file name "mydata.data", $1 would have the value
763: "mydata", and $2 would have the value "data".
764: The
765: .Ar outpattern
766: determines the resulting mapped filename.
1.29 aaron 767: The sequences
768: .Ql $1 ,
769: .Ql $2 ,
1.42 jmc 770: \&...,
1.29 aaron 771: .Ql $9
772: are replaced by any value resulting from the
1.1 deraadt 773: .Ar inpattern
774: template.
1.29 aaron 775: The sequence
776: .Ql $0
777: is replaced by the original filename.
1.1 deraadt 778: Additionally, the sequence
1.40 jmc 779: .Sq Op Ar seq1 , Ar seq2
1.1 deraadt 780: is replaced by
1.45 jmc 781: .Ar seq1
1.1 deraadt 782: if
783: .Ar seq1
784: is not a null string; otherwise it is replaced by
785: .Ar seq2 .
1.42 jmc 786: For example:
1.1 deraadt 787: .Pp
1.42 jmc 788: .Dl nmap $1.$2.$3 [$1,$2].[$2,file]
1.1 deraadt 789: .Pp
1.42 jmc 790: This command would yield the output filename
791: .Pa myfile.data
1.29 aaron 792: for input filenames
793: .Pa myfile.data
794: and
1.42 jmc 795: .Pa myfile.data.old ;
1.29 aaron 796: .Pa myfile.file
797: for the input filename
1.42 jmc 798: .Pa myfile ;
1.29 aaron 799: and
800: .Pa myfile.myfile
801: for the input filename
1.42 jmc 802: .Pa .myfile .
1.1 deraadt 803: Spaces may be included in
1.46 jmc 804: .Ar outpattern
805: by quoting them,
806: as in the following example:
1.42 jmc 807: .Bd -literal -offset indent
1.46 jmc 808: nmap $1.$2 "$1 $2"
1.29 aaron 809: .Ed
810: .Pp
811: Use the
812: .Ql \e
813: character to prevent special treatment
814: of the
815: .Ql $ ,
1.80 schwarze 816: .Ql \&[ ,
1.29 aaron 817: .Ql \&] ,
818: and
819: .Ql \&,
820: characters.
1.1 deraadt 821: .It Ic ntrans Op Ar inchars Op Ar outchars
822: Set or unset the filename character translation mechanism.
823: If no arguments are specified, the filename character
824: translation mechanism is unset.
825: If arguments are specified, characters in
826: remote filenames are translated during
827: .Ic mput
828: commands and
829: .Ic put
830: commands issued without a specified remote target filename.
831: If arguments are specified, characters in
832: local filenames are translated during
833: .Ic mget
834: commands and
835: .Ic get
836: commands issued without a specified local target filename.
1.42 jmc 837: This command is useful when connecting to a non-UNIX remote computer
1.1 deraadt 838: with different file naming conventions or practices.
839: Characters in a filename matching a character in
840: .Ar inchars
841: are replaced with the corresponding character in
1.6 millert 842: .Ar outchars .
1.1 deraadt 843: If the character's position in
844: .Ar inchars
845: is longer than the length of
1.29 aaron 846: .Ar outchars ,
1.1 deraadt 847: the character is deleted from the file name.
848: .It Ic open Ar host Op Ar port
849: Establish a connection to the specified
850: .Ar host
1.48 jmc 851: FTP server.
1.42 jmc 852: An optional port number may be supplied,
1.22 aaron 853: in which case
1.6 millert 854: .Nm
1.48 jmc 855: will attempt to contact an FTP server at that port.
1.1 deraadt 856: If the
857: .Ic auto-login
858: option is on (default),
1.6 millert 859: .Nm
1.1 deraadt 860: will also attempt to automatically log the user in to
1.48 jmc 861: the FTP server (see below).
1.9 millert 862: .It Ic page Ar file
863: Retrieve
864: .Ic file
865: and display with the program defined in
1.25 aaron 866: .Ev PAGER
1.26 pjanzen 867: (defaulting to
868: .Xr more 1
869: if
870: .Ev PAGER
871: is null or not defined).
1.73 sobrado 872: .It Ic passive Op Ic on | off
1.29 aaron 873: Toggle passive mode.
1.48 jmc 874: If passive mode is turned on (default is on),
875: .Nm
876: will send a
1.57 jmc 877: .Dv EPSV
1.1 deraadt 878: command for all data connections instead of the usual
879: .Dv PORT
1.29 aaron 880: command.
881: The
1.1 deraadt 882: .Dv PASV
883: command requests that the remote server open a port for the data connection
1.29 aaron 884: and return the address of that port.
885: The remote server listens on that port and the client connects to it.
886: When using the more traditional
1.1 deraadt 887: .Dv PORT
888: command, the client listens on a port and sends that address to the remote
1.29 aaron 889: server, who connects back to it.
890: Passive mode is useful when using
1.6 millert 891: .Nm
1.1 deraadt 892: through a gateway router or host that controls the directionality of
893: traffic.
1.48 jmc 894: (Note that though FTP servers are required to support the
1.1 deraadt 895: .Dv PASV
896: command by RFC 1123, some do not.)
1.73 sobrado 897: .It Ic preserve Op Ic on | off
1.6 millert 898: Toggle preservation of modification times on retrieved files.
1.73 sobrado 899: .It Ic progress Op Ic on | off
1.6 millert 900: Toggle display of transfer progress bar.
1.9 millert 901: The progress bar will be disabled for a transfer that has
902: .Ar local-file
903: as
1.48 jmc 904: .Sq -
1.9 millert 905: or a command that starts with
906: .Sq \&| .
907: Refer to
908: .Sx FILE NAMING CONVENTIONS
909: for more information.
1.73 sobrado 910: .It Ic prompt Op Ic on | off
1.1 deraadt 911: Toggle interactive prompting.
912: Interactive prompting
913: occurs during multiple file transfers to allow the
914: user to selectively retrieve or store files.
915: If prompting is turned off (default is on), any
916: .Ic mget
917: or
918: .Ic mput
919: will transfer all files, and any
920: .Ic mdelete
921: will delete all files.
1.6 millert 922: .Pp
923: When prompting is on, the following commands are available at a prompt:
924: .Bl -tag -width 2n -offset indent
1.69 martynas 925: .It Ic ?\&
926: Print help message.
1.6 millert 927: .It Ic a
928: Answer
1.22 aaron 929: .Dq yes
930: to the current file and automatically answer
931: .Dq yes
1.6 millert 932: to any remaining files for the current command.
1.42 jmc 933: .It Ic n
934: Do not transfer the file.
1.6 millert 935: .It Ic p
936: Answer
1.22 aaron 937: .Dq yes
938: to the current file and turn off prompt mode
939: (as if
1.6 millert 940: .Dq prompt off
941: had been given).
1.69 martynas 942: .It Ic q
943: Answer
944: .Dq no
945: to the current file and automatically answer
946: .Dq no
947: to any remaining files for the current command.
1.42 jmc 948: .It Ic y
949: Transfer the file.
1.6 millert 950: .El
1.73 sobrado 951: .It Ic proxy Ar command
1.48 jmc 952: Execute an FTP command on a secondary control connection.
953: This command allows simultaneous connection to two remote FTP
1.1 deraadt 954: servers for transferring files between the two servers.
955: The first
956: .Ic proxy
957: command should be an
1.29 aaron 958: .Ic open ,
1.1 deraadt 959: to establish the secondary control connection.
1.29 aaron 960: Enter the command
1.41 jmc 961: .Ic proxy ?\&
1.48 jmc 962: to see other FTP commands executable on the
1.1 deraadt 963: secondary connection.
964: The following commands behave differently when prefaced by
1.29 aaron 965: .Ic proxy :
1.1 deraadt 966: .Ic open
1.42 jmc 967: will not define new macros during the auto-login process;
1.1 deraadt 968: .Ic close
1.42 jmc 969: will not erase existing macro definitions;
1.1 deraadt 970: .Ic get
971: and
972: .Ic mget
973: transfer files from the host on the primary control connection
1.42 jmc 974: to the host on the secondary control connection; and
1.29 aaron 975: .Ic put ,
1.1 deraadt 976: .Ic mput ,
977: and
978: .Ic append
979: transfer files from the host on the secondary control connection
980: to the host on the primary control connection.
1.48 jmc 981: Third party file transfers depend upon support of the FTP protocol
1.1 deraadt 982: .Dv PASV
983: command by the server on the secondary control connection.
984: .It Ic put Ar local-file Op Ar remote-file
985: Store a local file on the remote machine.
986: If
987: .Ar remote-file
988: is left unspecified, the local file name is used
989: after processing according to any
990: .Ic ntrans
991: or
992: .Ic nmap
993: settings
994: in naming the remote file.
995: File transfer uses the
996: current settings for
1.29 aaron 997: .Ic type ,
1.1 deraadt 998: .Ic format ,
1.29 aaron 999: .Ic mode ,
1.1 deraadt 1000: and
1.6 millert 1001: .Ic structure .
1.1 deraadt 1002: .It Ic pwd
1003: Print the name of the current working directory on the remote
1004: machine.
1005: .It Ic quit
1006: A synonym for
1.6 millert 1007: .Ic bye .
1.73 sobrado 1008: .It Ic quote Ar arg ...
1.48 jmc 1009: The arguments specified are sent, verbatim, to the remote FTP server.
1.1 deraadt 1010: .It Ic recv Ar remote-file Op Ar local-file
1.6 millert 1011: A synonym for
1012: .Ic get .
1.1 deraadt 1013: .It Ic reget Ar remote-file Op Ar local-file
1014: Reget acts like get, except that if
1015: .Ar local-file
1016: exists and is
1017: smaller than
1.29 aaron 1018: .Ar remote-file ,
1.1 deraadt 1019: .Ar local-file
1020: is presumed to be
1021: a partially transferred copy of
1022: .Ar remote-file
1023: and the transfer
1024: is continued from the apparent point of failure.
1025: This command
1026: is useful when transferring very large files over networks that
1027: are prone to dropping connections.
1.73 sobrado 1028: .It Ic rename Ar from-name to-name
1.1 deraadt 1029: Rename the file
1.73 sobrado 1030: .Ar from-name
1.22 aaron 1031: on the remote machine to the file
1.73 sobrado 1032: .Ar to-name .
1.70 martynas 1033: .It Ic reput Ar local-file Op Ar remote-file
1034: Reput acts like put, except that if
1035: .Ar remote-file
1036: exists and is
1037: smaller than
1038: .Ar local-file ,
1039: .Ar remote-file
1040: is presumed to be
1041: a partially transferred copy of
1042: .Ar local-file
1043: and the transfer
1044: is continued from the apparent point of failure.
1045: This command
1046: is useful when transferring very large files over networks that
1047: are prone to dropping connections.
1.1 deraadt 1048: .It Ic reset
1049: Clear reply queue.
1050: This command re-synchronizes command/reply sequencing with the remote
1.48 jmc 1051: FTP server.
1052: Resynchronization may be necessary following a violation of the FTP protocol
1.1 deraadt 1053: by the remote server.
1054: .It Ic restart Ar marker
1055: Restart the immediately following
1056: .Ic get
1057: or
1058: .Ic put
1059: at the
1060: indicated
1.6 millert 1061: .Ar marker .
1.1 deraadt 1062: On
1063: .Ux
1.22 aaron 1064: systems,
1065: .Ar marker
1066: is usually a byte
1.1 deraadt 1067: offset into the file.
1.42 jmc 1068: .It Ic rhelp Op Ar command-name
1.48 jmc 1069: Request help from the remote FTP server.
1.42 jmc 1070: If a
1071: .Ar command-name
1072: is specified, it is supplied to the server as well.
1.1 deraadt 1073: .It Ic rmdir Ar directory-name
1074: Delete a directory on the remote machine.
1.73 sobrado 1075: .It Ic rstatus Op Ar file
1.42 jmc 1076: With no arguments, show status of remote machine.
1077: If
1.73 sobrado 1078: .Ar file
1.42 jmc 1079: is specified, show status of
1.73 sobrado 1080: .Ar file
1.42 jmc 1081: on remote machine.
1.73 sobrado 1082: .It Ic runique Op Ic on | off
1.1 deraadt 1083: Toggle storing of files on the local system with unique filenames.
1084: If a file already exists with a name equal to the target
1085: local filename for a
1086: .Ic get
1087: or
1088: .Ic mget
1.29 aaron 1089: command, a
1.42 jmc 1090: .Dq .1
1.29 aaron 1091: is appended to the name.
1.1 deraadt 1092: If the resulting name matches another existing file,
1.29 aaron 1093: a
1.42 jmc 1094: .Dq .2
1.29 aaron 1095: is appended to the original name.
1096: If this process continues up to
1.42 jmc 1097: .Dq .99 ,
1098: an error message is printed, and the transfer does not take place.
1.1 deraadt 1099: The generated unique filename will be reported.
1100: Note that
1101: .Ic runique
1102: will not affect local files generated from a shell command
1103: (see below).
1104: The default value is off.
1105: .It Ic send Ar local-file Op Ar remote-file
1.6 millert 1106: A synonym for
1107: .Ic put .
1.73 sobrado 1108: .It Ic sendport Op Ic on | off
1.1 deraadt 1109: Toggle the use of
1110: .Dv PORT
1111: commands.
1112: By default,
1.6 millert 1113: .Nm
1.1 deraadt 1114: will attempt to use a
1115: .Dv PORT
1116: command when establishing
1117: a connection for each data transfer.
1118: The use of
1119: .Dv PORT
1120: commands can prevent delays
1121: when performing multiple file transfers.
1122: If the
1123: .Dv PORT
1124: command fails,
1.6 millert 1125: .Nm
1.1 deraadt 1126: will use the default data port.
1127: When the use of
1128: .Dv PORT
1129: commands is disabled, no attempt will be made to use
1130: .Dv PORT
1131: commands for each data transfer.
1.48 jmc 1132: This is useful for certain FTP implementations which do ignore
1.1 deraadt 1133: .Dv PORT
1134: commands but, incorrectly, indicate they've been accepted.
1.73 sobrado 1135: .It Ic site Ar arg ...
1.48 jmc 1136: The arguments specified are sent, verbatim, to the remote FTP server as a
1.1 deraadt 1137: .Dv SITE
1138: command.
1.73 sobrado 1139: .It Ic size Ar file
1.1 deraadt 1140: Return size of
1.73 sobrado 1141: .Ar file
1.1 deraadt 1142: on remote machine.
1143: .It Ic status
1144: Show the current status of
1.48 jmc 1145: .Nm .
1.42 jmc 1146: .\" .It Ic struct Op Ar struct-name
1147: .\" Set the file transfer
1148: .\" .Ar structure
1149: .\" to
1150: .\" .Ar struct-name .
1151: .\" By default,
1152: .\" .Dq file
1153: .\" structure is used.
1.73 sobrado 1154: .It Ic sunique Op Ic on | off
1.1 deraadt 1155: Toggle storing of files on remote machine under unique file names.
1.48 jmc 1156: The remote FTP server must support the FTP protocol
1.1 deraadt 1157: .Dv STOU
1158: command for
1159: successful completion.
1.42 jmc 1160: The remote server will report the unique name.
1.1 deraadt 1161: Default value is off.
1162: .It Ic system
1163: Show the type of operating system running on the remote machine.
1164: .It Ic tenex
1165: Set the file transfer type to that needed to
1166: talk to
1167: .Tn TENEX
1168: machines.
1.73 sobrado 1169: .It Ic trace Op Ic on | off
1.1 deraadt 1170: Toggle packet tracing.
1171: .It Ic type Op Ar type-name
1172: Set the file transfer
1173: .Ic type
1174: to
1.6 millert 1175: .Ar type-name .
1.1 deraadt 1176: If no type is specified, the current type
1177: is printed.
1.42 jmc 1178: The default type is
1179: .Dq binary .
1.1 deraadt 1180: .It Ic umask Op Ar newmask
1181: Set the default umask on the remote server to
1.6 millert 1182: .Ar newmask .
1.1 deraadt 1183: If
1184: .Ar newmask
1185: is omitted, the current umask is printed.
1186: .It Xo
1.73 sobrado 1187: .Ic user Ar username
1.6 millert 1188: .Op Ar password Op Ar account
1.1 deraadt 1189: .Xc
1.48 jmc 1190: Identify yourself to the remote FTP server.
1.1 deraadt 1191: If the
1192: .Ar password
1193: is not specified and the server requires it,
1.6 millert 1194: .Nm
1.1 deraadt 1195: will prompt the user for it (after disabling local echo).
1196: If an
1197: .Ar account
1.48 jmc 1198: field is not specified, and the FTP server requires it,
1199: the user will be prompted for it.
1.1 deraadt 1200: If an
1201: .Ar account
1202: field is specified, an account command will
1203: be relayed to the remote server after the login sequence
1204: is completed if the remote server did not require it
1205: for logging in.
1206: Unless
1.6 millert 1207: .Nm
1.42 jmc 1208: is invoked with
1209: .Dq auto-login
1210: disabled, this process is done automatically on initial connection to the
1.48 jmc 1211: FTP server.
1.73 sobrado 1212: .It Ic verbose Op Ic on | off
1.1 deraadt 1213: Toggle verbose mode.
1214: In verbose mode, all responses from
1.48 jmc 1215: the FTP server are displayed to the user.
1.1 deraadt 1216: In addition,
1217: if verbose is on, when a file transfer completes, statistics
1218: regarding the efficiency of the transfer are reported.
1219: By default,
1220: verbose is on.
1221: .El
1222: .Pp
1223: Command arguments which have embedded spaces may be quoted with
1.29 aaron 1224: quote
1.42 jmc 1225: .Pq Ql \&"
1.29 aaron 1226: marks.
1.6 millert 1227: .Pp
1228: Commands which toggle settings can take an explicit
1229: .Ic on
1230: or
1231: .Ic off
1232: argument to force the setting appropriately.
1233: .Pp
1234: If
1235: .Nm
1236: receives a
1237: .Dv SIGINFO
1238: (see the
1239: .Dq status
1240: argument of
1241: .Xr stty 1 )
1242: signal whilst a transfer is in progress, the current transfer rate
1243: statistics will be written to the standard error output, in the
1244: same format as the standard completion message.
1245: .Sh AUTO-FETCHING FILES
1246: In addition to standard commands, this version of
1247: .Nm
1248: supports an auto-fetch feature.
1249: To enable auto-fetch, simply pass the list of hostnames/files
1250: on the command line.
1251: .Pp
1252: The following formats are valid syntax for an auto-fetch element:
1.56 ray 1253: .Bl -tag -width Ds
1.42 jmc 1254: .It host:/file[/]
1.6 millert 1255: .Dq Classic
1.48 jmc 1256: .Nm
1257: format.
1.42 jmc 1258: .It ftp://[user:password@]host[:port]/file[/]
1.48 jmc 1259: An FTP URL, retrieved using the FTP protocol if
1.10 millert 1260: .Ev ftp_proxy
1261: isn't defined.
1.48 jmc 1262: Otherwise, transfer using HTTP via the proxy defined in
1.10 millert 1263: .Ev ftp_proxy .
1.84 ! lteo 1264: If a
! 1265: .Ar user
! 1266: and
! 1267: .Ar password
! 1268: are given and
1.11 millert 1269: .Ev ftp_proxy
1.84 ! lteo 1270: isn't defined,
! 1271: log in as
1.11 millert 1272: .Ar user
1273: with a password of
1274: .Ar password .
1.83 haesbaer 1275: .It http://[user:password@]host[:port]/file
1.48 jmc 1276: An HTTP URL, retrieved using the HTTP protocol.
1.6 millert 1277: If
1278: .Ev http_proxy
1279: is defined, it is used as a URL to an HTTP proxy server.
1.84 ! lteo 1280: If a
! 1281: .Ar user
! 1282: and
! 1283: .Ar password
! 1284: are given and
! 1285: .Ev http_proxy
! 1286: isn't defined,
! 1287: log in as
! 1288: .Ar user
! 1289: with a password of
! 1290: .Ar password
! 1291: using Basic authentication.
1.83 haesbaer 1292: .It https://[user:password@]host[:port]/file
1.54 deraadt 1293: An HTTPS URL, retrieved using the HTTPS protocol.
1294: If
1295: .Ev http_proxy
1296: is defined, this HTTPS proxy server will be used to fetch the
1297: file using the CONNECT method.
1.84 ! lteo 1298: If a
! 1299: .Ar user
! 1300: and
! 1301: .Ar password
! 1302: are given and
! 1303: .Ev http_proxy
! 1304: isn't defined,
! 1305: log in as
! 1306: .Ar user
! 1307: with a password of
! 1308: .Ar password
! 1309: using Basic authentication.
1.78 sobrado 1310: .It file:file
1311: .Ar file
1312: is retrieved from a mounted file system.
1.6 millert 1313: .El
1314: .Pp
1.48 jmc 1315: If a classic format or an FTP URL format has a trailing
1.6 millert 1316: .Sq / ,
1317: then
1318: .Nm
1319: will connect to the site and
1320: .Ic cd
1321: to the directory given as the path, and leave the user in interactive
1322: mode ready for further input.
1323: .Pp
1.48 jmc 1324: If successive auto-fetch FTP elements refer to the same host, then
1.6 millert 1325: the connection is maintained between transfers, reducing overhead on
1326: connection creation and deletion.
1.9 millert 1327: .Pp
1328: If
1.42 jmc 1329: .Ar file
1330: contains a glob character and globbing is enabled
1.9 millert 1331: (see
1.13 millert 1332: .Ic glob ) ,
1.9 millert 1333: then the equivalent of
1.42 jmc 1334: .Ic mget Ar file
1.9 millert 1335: is performed.
1336: .Pp
1.19 d 1337: If no
1338: .Fl o
1339: option is specified, and
1340: the directory component of
1.42 jmc 1341: .Ar file
1.9 millert 1342: contains no globbing characters,
1.19 d 1343: then
1.9 millert 1344: it is stored in the current directory as the
1345: .Xr basename 1
1346: of
1.42 jmc 1347: .Ar file .
1348: If
1349: .Fl o Ar output
1350: is specified, then
1351: .Ar file
1352: is stored as
1353: .Ar output .
1.9 millert 1354: Otherwise, the remote name is used as the local name.
1.1 deraadt 1355: .Sh ABORTING A FILE TRANSFER
1356: To abort a file transfer, use the terminal interrupt key
1357: (usually Ctrl-C).
1358: Sending transfers will be immediately halted.
1.48 jmc 1359: Receiving transfers will be halted by sending an FTP protocol
1.1 deraadt 1360: .Dv ABOR
1361: command to the remote server, and discarding any further data received.
1362: The speed at which this is accomplished depends upon the remote
1363: server's support for
1364: .Dv ABOR
1365: processing.
1366: If the remote server does not support the
1367: .Dv ABOR
1368: command, an
1.51 jmc 1369: .Ql ftp\*(Gt
1.1 deraadt 1370: prompt will not appear until the remote server has completed
1371: sending the requested file.
1372: .Pp
1373: The terminal interrupt key sequence will be ignored when
1.6 millert 1374: .Nm
1.1 deraadt 1375: has completed any local processing and is awaiting a reply
1376: from the remote server.
1377: A long delay in this mode may result from the ABOR processing described
1378: above, or from unexpected behavior by the remote server, including
1.48 jmc 1379: violations of the FTP protocol.
1.1 deraadt 1380: If the delay results from unexpected remote server behavior, the local
1.6 millert 1381: .Nm
1.1 deraadt 1382: program must be killed by hand.
1383: .Sh FILE NAMING CONVENTIONS
1384: Files specified as arguments to
1.6 millert 1385: .Nm
1.1 deraadt 1386: commands are processed according to the following rules.
1387: .Bl -enum
1388: .It
1389: If the file name
1.48 jmc 1390: .Sq -
1.29 aaron 1391: is specified, the standard input (for reading)
1392: or standard output (for writing)
1393: is used.
1.1 deraadt 1394: .It
1395: If the first character of the file name is
1396: .Sq \&| ,
1397: the
1398: remainder of the argument is interpreted as a shell command.
1.6 millert 1399: .Nm
1.1 deraadt 1400: then forks a shell, using
1401: .Xr popen 3
1.29 aaron 1402: with the argument supplied, and reads (writes) from the standard output
1403: (standard input).
1.1 deraadt 1404: If the shell command includes spaces, the argument
1.29 aaron 1405: must be quoted; e.g.,
1.42 jmc 1406: .Qq ls -lt .
1.1 deraadt 1407: A particularly
1.42 jmc 1408: useful example of this mechanism is:
1409: .Qq dir |more .
1.1 deraadt 1410: .It
1.29 aaron 1411: Failing the above checks, if
1412: .Dq globbing
1413: is enabled,
1.1 deraadt 1414: local file names are expanded
1415: according to the rules used in the
1.29 aaron 1416: .Xr csh 1 ;
1.1 deraadt 1417: c.f. the
1418: .Ic glob
1419: command.
1420: If the
1.6 millert 1421: .Nm
1.29 aaron 1422: command expects a single local file (e.g.,
1423: .Ic put ) ,
1424: only the first filename generated by the
1425: .Dq globbing
1426: operation is used.
1.1 deraadt 1427: .It
1428: For
1429: .Ic mget
1430: commands and
1431: .Ic get
1432: commands with unspecified local file names, the local filename is
1433: the remote filename, which may be altered by a
1.29 aaron 1434: .Ic case ,
1.1 deraadt 1435: .Ic ntrans ,
1436: or
1437: .Ic nmap
1438: setting.
1439: The resulting filename may then be altered if
1440: .Ic runique
1441: is on.
1442: .It
1443: For
1444: .Ic mput
1445: commands and
1446: .Ic put
1447: commands with unspecified remote file names, the remote filename is
1448: the local filename, which may be altered by a
1449: .Ic ntrans
1450: or
1451: .Ic nmap
1452: setting.
1453: The resulting filename may then be altered by the remote server if
1454: .Ic sunique
1455: is on.
1456: .El
1457: .Sh FILE TRANSFER PARAMETERS
1458: The FTP specification specifies many parameters which may
1459: affect a file transfer.
1460: The
1461: .Ic type
1.42 jmc 1462: may be one of
1463: .Dq ascii ,
1464: .Dq binary ,
1465: .Dq image ,
1466: .Dq ebcdic
1467: .Pq currently not supported
1468: or
1469: .Dq tenex
1470: (local byte size 8, for PDP-10's and PDP-20's mostly).
1.6 millert 1471: .Nm
1.38 jmc 1472: supports the ASCII and image types of file transfer,
1.1 deraadt 1473: plus local byte size 8 for
1474: .Ic tenex
1475: mode transfers.
1476: .Pp
1.6 millert 1477: .Nm
1.1 deraadt 1478: supports only the default values for the remaining
1479: file transfer parameters:
1.29 aaron 1480: .Ic mode ,
1.1 deraadt 1481: .Ic form ,
1482: and
1.6 millert 1483: .Ic struct .
1.1 deraadt 1484: .Sh THE .netrc FILE
1485: The
1486: .Pa .netrc
1487: file contains login and initialization information
1488: used by the auto-login process.
1489: It resides in the user's home directory.
1490: The following tokens are recognized; they may be separated by spaces,
1491: tabs, or new-lines:
1492: .Bl -tag -width password
1493: .It Ic machine Ar name
1494: Identify a remote machine
1495: .Ar name .
1496: The auto-login process searches the
1497: .Pa .netrc
1498: file for a
1499: .Ic machine
1500: token that matches the remote machine specified on the
1.6 millert 1501: .Nm
1.1 deraadt 1502: command line or as an
1503: .Ic open
1504: command argument.
1505: Once a match is made, the subsequent
1506: .Pa .netrc
1507: tokens are processed,
1508: stopping when the end of file is reached or another
1509: .Ic machine
1510: or a
1511: .Ic default
1512: token is encountered.
1513: .It Ic default
1514: This is the same as
1515: .Ic machine
1516: .Ar name
1517: except that
1518: .Ic default
1519: matches any name.
1520: There can be only one
1521: .Ic default
1522: token, and it must be after all
1523: .Ic machine
1524: tokens.
1525: This is normally used as:
1526: .Pp
1527: .Dl default login anonymous password user@site
1528: .Pp
1529: thereby giving the user
1530: .Ar automatic
1.48 jmc 1531: anonymous FTP login to
1.1 deraadt 1532: machines not specified in
1533: .Pa .netrc .
1534: This can be overridden
1535: by using the
1536: .Fl n
1537: flag to disable auto-login.
1538: .It Ic login Ar name
1539: Identify a user on the remote machine.
1540: If this token is present, the auto-login process will initiate
1541: a login using the specified
1542: .Ar name .
1543: .It Ic password Ar string
1544: Supply a password.
1545: If this token is present, the auto-login process will supply the
1546: specified string if the remote server requires a password as part
1547: of the login process.
1548: Note that if this token is present in the
1549: .Pa .netrc
1550: file for any user other
1551: than
1.29 aaron 1552: .Ar anonymous ,
1.6 millert 1553: .Nm
1.1 deraadt 1554: will abort the auto-login process if the
1555: .Pa .netrc
1556: is readable by
1557: anyone besides the user.
1558: .It Ic account Ar string
1559: Supply an additional account password.
1560: If this token is present, the auto-login process will supply the
1561: specified string if the remote server requires an additional
1562: account password, or the auto-login process will initiate an
1563: .Dv ACCT
1564: command if it does not.
1565: .It Ic macdef Ar name
1566: Define a macro.
1567: This token functions like the
1.6 millert 1568: .Nm
1.1 deraadt 1569: .Ic macdef
1570: command functions.
1571: A macro is defined with the specified name; its contents begin with the
1572: next
1573: .Pa .netrc
1574: line and continue until a null line (consecutive new-line
1575: characters) is encountered.
1.50 jmc 1576: Like the other tokens in the
1577: .Pa .netrc
1578: file, a
1579: .Ic macdef
1580: is applicable only to the
1581: .Ic machine
1582: definition preceding it.
1583: A
1584: .Ic macdef
1585: entry cannot be utilized by multiple
1586: .Ic machine
1587: definitions; rather, it must be defined following each
1588: .Ic machine
1589: it is intended to be used with.
1.1 deraadt 1590: If a macro named
1591: .Ic init
1592: is defined, it is automatically executed as the last step in the
1593: auto-login process.
1594: .El
1.6 millert 1595: .Sh COMMAND LINE EDITING
1596: .Nm
1.25 aaron 1597: supports interactive command line editing, via the
1.6 millert 1598: .Xr editline 3
1599: library.
1600: It is enabled with the
1601: .Ic edit
1.9 millert 1602: command, and is enabled by default if input is from a tty.
1.6 millert 1603: Previous lines can be recalled and edited with the arrow keys,
1604: and other GNU Emacs-style editing keys may be used as well.
1605: .Pp
1606: The
1607: .Xr editline 3
1608: library is configured with a
1609: .Pa .editrc
1.42 jmc 1610: file \- refer to
1.6 millert 1611: .Xr editrc 5
1612: for more information.
1613: .Pp
1614: An extra key binding is available to
1615: .Nm
1616: to provide context sensitive command and filename completion
1617: (including remote file completion).
1618: To use this, bind a key to the
1619: .Xr editline 3
1620: command
1621: .Ic ftp-complete .
1622: By default, this is bound to the TAB key.
1.1 deraadt 1623: .Sh ENVIRONMENT
1.6 millert 1624: .Nm
1.22 aaron 1625: utilizes the following environment variables:
1.15 millert 1626: .Bl -tag -width "FTPSERVERPORT"
1.16 millert 1627: .It Ev FTPMODE
1.29 aaron 1628: Overrides the default operation mode.
1629: Recognized values are:
1.48 jmc 1630: .Pp
1631: .Bl -tag -width "passive " -offset indent -compact
1.16 millert 1632: .It passive
1.48 jmc 1633: passive mode FTP only
1.16 millert 1634: .It active
1.48 jmc 1635: active mode FTP only
1.16 millert 1636: .It auto
1637: automatic determination of passive or active (this is the default)
1638: .It gate
1639: gate-ftp mode
1640: .El
1.14 millert 1641: .It Ev FTPSERVER
1642: Host to use as gate-ftp server when
1643: .Ic gate
1644: is enabled.
1645: .It Ev FTPSERVERPORT
1646: Port to use when connecting to gate-ftp server when
1647: .Ic gate
1648: is enabled.
1649: Default is port returned by a
1650: .Fn getservbyname
1.25 aaron 1651: lookup of
1.14 millert 1652: .Dq ftpgate/tcp .
1.1 deraadt 1653: .It Ev HOME
1654: For default location of a
1655: .Pa .netrc
1656: file, if one exists.
1.9 millert 1657: .It Ev PAGER
1658: Used by
1659: .Ic page
1660: to display files.
1.1 deraadt 1661: .It Ev SHELL
1662: For default shell.
1.15 millert 1663: .It Ev TMPDIR
1.72 martynas 1664: Directory in which temporary files are stored.
1.10 millert 1665: .It Ev ftp_proxy
1666: URL of FTP proxy to use when making FTP URL requests
1.48 jmc 1667: (if not defined, use the standard FTP protocol).
1.6 millert 1668: .It Ev http_proxy
1.54 deraadt 1669: URL of HTTP proxy to use when making HTTP or HTTPS URL requests.
1.59 pyr 1670: .It Ev http_cookies
1.60 jmc 1671: Path of a Netscape-like cookiejar file to use when making
1.59 pyr 1672: HTTP or HTTPS URL requests.
1.1 deraadt 1673: .El
1.36 jakob 1674: .Sh PORT ALLOCATION
1.38 jmc 1675: For active mode data connections,
1.36 jakob 1676: .Nm
1.42 jmc 1677: will listen to a random high TCP port.
1.36 jakob 1678: The interval of ports used are configurable using
1.38 jmc 1679: .Xr sysctl 8
1.36 jakob 1680: variables
1.42 jmc 1681: .Va net.inet.ip.porthifirst
1.36 jakob 1682: and
1.42 jmc 1683: .Va net.inet.ip.porthilast .
1.1 deraadt 1684: .Sh SEE ALSO
1.42 jmc 1685: .Xr basename 1 ,
1686: .Xr csh 1 ,
1687: .Xr more 1 ,
1688: .Xr stty 1 ,
1689: .Xr tar 1 ,
1.28 aaron 1690: .Xr tftp 1 ,
1.42 jmc 1691: .Xr editline 3 ,
1.14 millert 1692: .Xr getservbyname 3 ,
1.42 jmc 1693: .Xr popen 3 ,
1.6 millert 1694: .Xr editrc 5 ,
1.14 millert 1695: .Xr services 5 ,
1.34 beck 1696: .Xr ftp-proxy 8 ,
1.1 deraadt 1697: .Xr ftpd 8
1698: .Sh HISTORY
1699: The
1.6 millert 1700: .Nm
1.1 deraadt 1701: command appeared in
1702: .Bx 4.2 .
1703: .Sh BUGS
1704: Correct execution of many commands depends upon proper behavior
1705: by the remote server.
1706: .Pp
1707: An error in the treatment of carriage returns
1708: in the
1709: .Bx 4.2
1.22 aaron 1710: ASCII-mode transfer code
1.1 deraadt 1711: has been corrected.
1712: This correction may result in incorrect transfers of binary files
1713: to and from
1714: .Bx 4.2
1.22 aaron 1715: servers using the ASCII type.
1.1 deraadt 1716: Avoid this problem by using the binary image type.
1.71 martynas 1717: .Pp
1718: In the recursive mode of
1719: .Ic mget ,
1720: files and directories starting with whitespace are ignored
1721: because the list cannot be parsed any other way.