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