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