Annotation of src/usr.bin/ftp/ftp.1, Revision 1.46
1.46 ! jmc 1: .\" $OpenBSD: ftp.1,v 1.45 2005/01/03 14:47:52 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.46 ! jmc 683: .Ar outpattern
! 684: by quoting them,
! 685: as in the following example:
1.42 jmc 686: .Bd -literal -offset indent
1.46 ! jmc 687: nmap $1.$2 "$1 $2"
1.29 aaron 688: .Ed
689: .Pp
690: Use the
691: .Ql \e
692: character to prevent special treatment
693: of the
694: .Ql $ ,
695: .Ql [ ,
696: .Ql \&] ,
697: and
698: .Ql \&,
699: characters.
1.1 deraadt 700: .It Ic ntrans Op Ar inchars Op Ar outchars
701: Set or unset the filename character translation mechanism.
702: If no arguments are specified, the filename character
703: translation mechanism is unset.
704: If arguments are specified, characters in
705: remote filenames are translated during
706: .Ic mput
707: commands and
708: .Ic put
709: commands issued without a specified remote target filename.
710: If arguments are specified, characters in
711: local filenames are translated during
712: .Ic mget
713: commands and
714: .Ic get
715: commands issued without a specified local target filename.
1.42 jmc 716: This command is useful when connecting to a non-UNIX remote computer
1.1 deraadt 717: with different file naming conventions or practices.
718: Characters in a filename matching a character in
719: .Ar inchars
720: are replaced with the corresponding character in
1.6 millert 721: .Ar outchars .
1.1 deraadt 722: If the character's position in
723: .Ar inchars
724: is longer than the length of
1.29 aaron 725: .Ar outchars ,
1.1 deraadt 726: the character is deleted from the file name.
727: .It Ic open Ar host Op Ar port
728: Establish a connection to the specified
729: .Ar host
730: .Tn FTP
731: server.
1.42 jmc 732: An optional port number may be supplied,
1.22 aaron 733: in which case
1.6 millert 734: .Nm
1.1 deraadt 735: will attempt to contact an
736: .Tn FTP
737: server at that port.
738: If the
739: .Ic auto-login
740: option is on (default),
1.6 millert 741: .Nm
1.1 deraadt 742: will also attempt to automatically log the user in to
743: the
744: .Tn FTP
745: server (see below).
1.9 millert 746: .It Ic page Ar file
747: Retrieve
748: .Ic file
749: and display with the program defined in
1.25 aaron 750: .Ev PAGER
1.26 pjanzen 751: (defaulting to
752: .Xr more 1
753: if
754: .Ev PAGER
755: is null or not defined).
1.1 deraadt 756: .It Ic passive
1.29 aaron 757: Toggle passive mode.
758: If passive mode is turned on (default is on), the ftp client will
1.1 deraadt 759: send a
760: .Dv PASV
761: command for all data connections instead of the usual
762: .Dv PORT
1.29 aaron 763: command.
764: The
1.1 deraadt 765: .Dv PASV
766: command requests that the remote server open a port for the data connection
1.29 aaron 767: and return the address of that port.
768: The remote server listens on that port and the client connects to it.
769: When using the more traditional
1.1 deraadt 770: .Dv PORT
771: command, the client listens on a port and sends that address to the remote
1.29 aaron 772: server, who connects back to it.
773: Passive mode is useful when using
1.6 millert 774: .Nm
1.1 deraadt 775: through a gateway router or host that controls the directionality of
776: traffic.
777: (Note that though ftp servers are required to support the
778: .Dv PASV
779: command by RFC 1123, some do not.)
1.6 millert 780: .It Ic preserve
781: Toggle preservation of modification times on retrieved files.
782: .It Ic progress
783: Toggle display of transfer progress bar.
1.9 millert 784: The progress bar will be disabled for a transfer that has
785: .Ar local-file
786: as
1.29 aaron 787: .Dq -
1.9 millert 788: or a command that starts with
789: .Sq \&| .
790: Refer to
791: .Sx FILE NAMING CONVENTIONS
792: for more information.
1.1 deraadt 793: .It Ic prompt
794: Toggle interactive prompting.
795: Interactive prompting
796: occurs during multiple file transfers to allow the
797: user to selectively retrieve or store files.
798: If prompting is turned off (default is on), any
799: .Ic mget
800: or
801: .Ic mput
802: will transfer all files, and any
803: .Ic mdelete
804: will delete all files.
1.6 millert 805: .Pp
806: When prompting is on, the following commands are available at a prompt:
807: .Bl -tag -width 2n -offset indent
808: .It Ic a
809: Answer
1.22 aaron 810: .Dq yes
811: to the current file and automatically answer
812: .Dq yes
1.6 millert 813: to any remaining files for the current command.
1.42 jmc 814: .It Ic n
815: Do not transfer the file.
1.6 millert 816: .It Ic p
817: Answer
1.22 aaron 818: .Dq yes
819: to the current file and turn off prompt mode
820: (as if
1.6 millert 821: .Dq prompt off
822: had been given).
1.42 jmc 823: .It Ic y
824: Transfer the file.
1.6 millert 825: .El
1.1 deraadt 826: .It Ic proxy Ar ftp-command
827: Execute an ftp command on a secondary control connection.
828: This command allows simultaneous connection to two remote ftp
829: servers for transferring files between the two servers.
830: The first
831: .Ic proxy
832: command should be an
1.29 aaron 833: .Ic open ,
1.1 deraadt 834: to establish the secondary control connection.
1.29 aaron 835: Enter the command
1.41 jmc 836: .Ic proxy ?\&
1.29 aaron 837: to see other ftp commands executable on the
1.1 deraadt 838: secondary connection.
839: The following commands behave differently when prefaced by
1.29 aaron 840: .Ic proxy :
1.1 deraadt 841: .Ic open
1.42 jmc 842: will not define new macros during the auto-login process;
1.1 deraadt 843: .Ic close
1.42 jmc 844: will not erase existing macro definitions;
1.1 deraadt 845: .Ic get
846: and
847: .Ic mget
848: transfer files from the host on the primary control connection
1.42 jmc 849: to the host on the secondary control connection; and
1.29 aaron 850: .Ic put ,
1.1 deraadt 851: .Ic mput ,
852: and
853: .Ic append
854: transfer files from the host on the secondary control connection
855: to the host on the primary control connection.
856: Third party file transfers depend upon support of the ftp protocol
857: .Dv PASV
858: command by the server on the secondary control connection.
859: .It Ic put Ar local-file Op Ar remote-file
860: Store a local file on the remote machine.
861: If
862: .Ar remote-file
863: is left unspecified, the local file name is used
864: after processing according to any
865: .Ic ntrans
866: or
867: .Ic nmap
868: settings
869: in naming the remote file.
870: File transfer uses the
871: current settings for
1.29 aaron 872: .Ic type ,
1.1 deraadt 873: .Ic format ,
1.29 aaron 874: .Ic mode ,
1.1 deraadt 875: and
1.6 millert 876: .Ic structure .
1.1 deraadt 877: .It Ic pwd
878: Print the name of the current working directory on the remote
879: machine.
880: .It Ic quit
881: A synonym for
1.6 millert 882: .Ic bye .
1.1 deraadt 883: .It Ic quote Ar arg1 arg2 ...
884: The arguments specified are sent, verbatim, to the remote
885: .Tn FTP
886: server.
887: .It Ic recv Ar remote-file Op Ar local-file
1.6 millert 888: A synonym for
889: .Ic get .
1.1 deraadt 890: .It Ic reget Ar remote-file Op Ar local-file
891: Reget acts like get, except that if
892: .Ar local-file
893: exists and is
894: smaller than
1.29 aaron 895: .Ar remote-file ,
1.1 deraadt 896: .Ar local-file
897: is presumed to be
898: a partially transferred copy of
899: .Ar remote-file
900: and the transfer
901: is continued from the apparent point of failure.
902: This command
903: is useful when transferring very large files over networks that
904: are prone to dropping connections.
1.6 millert 905: .It Ic rename Op Ar from Op Ar to
1.1 deraadt 906: Rename the file
907: .Ar from
1.22 aaron 908: on the remote machine to the file
1.6 millert 909: .Ar to .
1.1 deraadt 910: .It Ic reset
911: Clear reply queue.
912: This command re-synchronizes command/reply sequencing with the remote
913: ftp server.
914: Resynchronization may be necessary following a violation of the ftp protocol
915: by the remote server.
916: .It Ic restart Ar marker
917: Restart the immediately following
918: .Ic get
919: or
920: .Ic put
921: at the
922: indicated
1.6 millert 923: .Ar marker .
1.1 deraadt 924: On
925: .Ux
1.22 aaron 926: systems,
927: .Ar marker
928: is usually a byte
1.1 deraadt 929: offset into the file.
1.42 jmc 930: .It Ic rhelp Op Ar command-name
931: Request help from the remote
932: .Tn FTP
933: server.
934: If a
935: .Ar command-name
936: is specified, it is supplied to the server as well.
1.1 deraadt 937: .It Ic rmdir Ar directory-name
938: Delete a directory on the remote machine.
1.42 jmc 939: .It Ic rstatus Op Ar file-name
940: With no arguments, show status of remote machine.
941: If
942: .Ar file-name
943: is specified, show status of
944: .Ar file-name
945: on remote machine.
1.1 deraadt 946: .It Ic runique
947: Toggle storing of files on the local system with unique filenames.
948: If a file already exists with a name equal to the target
949: local filename for a
950: .Ic get
951: or
952: .Ic mget
1.29 aaron 953: command, a
1.42 jmc 954: .Dq .1
1.29 aaron 955: is appended to the name.
1.1 deraadt 956: If the resulting name matches another existing file,
1.29 aaron 957: a
1.42 jmc 958: .Dq .2
1.29 aaron 959: is appended to the original name.
960: If this process continues up to
1.42 jmc 961: .Dq .99 ,
962: an error message is printed, and the transfer does not take place.
1.1 deraadt 963: The generated unique filename will be reported.
964: Note that
965: .Ic runique
966: will not affect local files generated from a shell command
967: (see below).
968: The default value is off.
969: .It Ic send Ar local-file Op Ar remote-file
1.6 millert 970: A synonym for
971: .Ic put .
1.1 deraadt 972: .It Ic sendport
973: Toggle the use of
974: .Dv PORT
975: commands.
976: By default,
1.6 millert 977: .Nm
1.1 deraadt 978: will attempt to use a
979: .Dv PORT
980: command when establishing
981: a connection for each data transfer.
982: The use of
983: .Dv PORT
984: commands can prevent delays
985: when performing multiple file transfers.
986: If the
987: .Dv PORT
988: command fails,
1.6 millert 989: .Nm
1.1 deraadt 990: will use the default data port.
991: When the use of
992: .Dv PORT
993: commands is disabled, no attempt will be made to use
994: .Dv PORT
995: commands for each data transfer.
996: This is useful
997: for certain
998: .Tn FTP
999: implementations which do ignore
1000: .Dv PORT
1001: commands but, incorrectly, indicate they've been accepted.
1002: .It Ic site Ar arg1 arg2 ...
1003: The arguments specified are sent, verbatim, to the remote
1004: .Tn FTP
1005: server as a
1006: .Dv SITE
1007: command.
1008: .It Ic size Ar file-name
1009: Return size of
1010: .Ar file-name
1011: on remote machine.
1012: .It Ic status
1013: Show the current status of
1.6 millert 1014: .Nm ftp .
1.42 jmc 1015: .\" .It Ic struct Op Ar struct-name
1016: .\" Set the file transfer
1017: .\" .Ar structure
1018: .\" to
1019: .\" .Ar struct-name .
1020: .\" By default,
1021: .\" .Dq file
1022: .\" structure is used.
1.1 deraadt 1023: .It Ic sunique
1024: Toggle storing of files on remote machine under unique file names.
1.42 jmc 1025: The remote ftp server must support the ftp protocol
1.1 deraadt 1026: .Dv STOU
1027: command for
1028: successful completion.
1.42 jmc 1029: The remote server will report the unique name.
1.1 deraadt 1030: Default value is off.
1031: .It Ic system
1032: Show the type of operating system running on the remote machine.
1033: .It Ic tenex
1034: Set the file transfer type to that needed to
1035: talk to
1036: .Tn TENEX
1037: machines.
1038: .It Ic trace
1039: Toggle packet tracing.
1040: .It Ic type Op Ar type-name
1041: Set the file transfer
1042: .Ic type
1043: to
1.6 millert 1044: .Ar type-name .
1.1 deraadt 1045: If no type is specified, the current type
1046: is printed.
1.42 jmc 1047: The default type is
1048: .Dq binary .
1.1 deraadt 1049: .It Ic umask Op Ar newmask
1050: Set the default umask on the remote server to
1.6 millert 1051: .Ar newmask .
1.1 deraadt 1052: If
1053: .Ar newmask
1054: is omitted, the current umask is printed.
1055: .It Xo
1056: .Ic user Ar user-name
1.6 millert 1057: .Op Ar password Op Ar account
1.1 deraadt 1058: .Xc
1059: Identify yourself to the remote
1060: .Tn FTP
1061: server.
1062: If the
1063: .Ar password
1064: is not specified and the server requires it,
1.6 millert 1065: .Nm
1.1 deraadt 1066: will prompt the user for it (after disabling local echo).
1067: If an
1068: .Ar account
1069: field is not specified, and the
1070: .Tn FTP
1071: server
1072: requires it, the user will be prompted for it.
1073: If an
1074: .Ar account
1075: field is specified, an account command will
1076: be relayed to the remote server after the login sequence
1077: is completed if the remote server did not require it
1078: for logging in.
1079: Unless
1.6 millert 1080: .Nm
1.42 jmc 1081: is invoked with
1082: .Dq auto-login
1083: disabled, this process is done automatically on initial connection to the
1.1 deraadt 1084: .Tn FTP
1085: server.
1086: .It Ic verbose
1087: Toggle verbose mode.
1088: In verbose mode, all responses from
1089: the
1090: .Tn FTP
1091: server are displayed to the user.
1092: In addition,
1093: if verbose is on, when a file transfer completes, statistics
1094: regarding the efficiency of the transfer are reported.
1095: By default,
1096: verbose is on.
1097: .El
1098: .Pp
1099: Command arguments which have embedded spaces may be quoted with
1.29 aaron 1100: quote
1.42 jmc 1101: .Pq Ql \&"
1.29 aaron 1102: marks.
1.6 millert 1103: .Pp
1104: Commands which toggle settings can take an explicit
1105: .Ic on
1106: or
1107: .Ic off
1108: argument to force the setting appropriately.
1109: .Pp
1110: If
1111: .Nm
1112: receives a
1113: .Dv SIGINFO
1114: (see the
1115: .Dq status
1116: argument of
1117: .Xr stty 1 )
1118: signal whilst a transfer is in progress, the current transfer rate
1119: statistics will be written to the standard error output, in the
1120: same format as the standard completion message.
1121: .Sh AUTO-FETCHING FILES
1122: In addition to standard commands, this version of
1123: .Nm
1124: supports an auto-fetch feature.
1125: To enable auto-fetch, simply pass the list of hostnames/files
1126: on the command line.
1127: .Pp
1128: The following formats are valid syntax for an auto-fetch element:
1.42 jmc 1129: .Bl -tag -width "ftp://[user:password@]host[:port]/file[/]"
1130: .It host:/file[/]
1.6 millert 1131: .Dq Classic
1.42 jmc 1132: ftp format.
1133: .It ftp://[user:password@]host[:port]/file[/]
1.11 millert 1134: An ftp URL, retrieved using the ftp protocol if
1.10 millert 1135: .Ev ftp_proxy
1136: isn't defined.
1137: Otherwise, transfer using http via the proxy defined in
1138: .Ev ftp_proxy .
1.11 millert 1139: If
1.42 jmc 1140: .Ar user : Ns Ar password Ns @
1.11 millert 1141: is given and
1142: .Ev ftp_proxy
1143: isn't defined, login as
1144: .Ar user
1145: with a password of
1146: .Ar password .
1.6 millert 1147: .It http://host[:port]/file
1.11 millert 1148: An http URL, retrieved using the http protocol.
1.6 millert 1149: If
1150: .Ev http_proxy
1151: is defined, it is used as a URL to an HTTP proxy server.
1152: .El
1153: .Pp
1.42 jmc 1154: If a classic format or an ftp URL format has a trailing
1.6 millert 1155: .Sq / ,
1156: then
1157: .Nm
1158: will connect to the site and
1159: .Ic cd
1160: to the directory given as the path, and leave the user in interactive
1161: mode ready for further input.
1162: .Pp
1163: If successive auto-fetch ftp elements refer to the same host, then
1164: the connection is maintained between transfers, reducing overhead on
1165: connection creation and deletion.
1.9 millert 1166: .Pp
1167: If
1.42 jmc 1168: .Ar file
1169: contains a glob character and globbing is enabled
1.9 millert 1170: (see
1.13 millert 1171: .Ic glob ) ,
1.9 millert 1172: then the equivalent of
1.42 jmc 1173: .Ic mget Ar file
1.9 millert 1174: is performed.
1175: .Pp
1.19 d 1176: If no
1177: .Fl o
1178: option is specified, and
1179: the directory component of
1.42 jmc 1180: .Ar file
1.9 millert 1181: contains no globbing characters,
1.19 d 1182: then
1.9 millert 1183: it is stored in the current directory as the
1184: .Xr basename 1
1185: of
1.42 jmc 1186: .Ar file .
1187: If
1188: .Fl o Ar output
1189: is specified, then
1190: .Ar file
1191: is stored as
1192: .Ar output .
1.9 millert 1193: Otherwise, the remote name is used as the local name.
1.1 deraadt 1194: .Sh ABORTING A FILE TRANSFER
1195: To abort a file transfer, use the terminal interrupt key
1196: (usually Ctrl-C).
1197: Sending transfers will be immediately halted.
1.22 aaron 1198: Receiving transfers will be halted by sending an ftp protocol
1.1 deraadt 1199: .Dv ABOR
1200: command to the remote server, and discarding any further data received.
1201: The speed at which this is accomplished depends upon the remote
1202: server's support for
1203: .Dv ABOR
1204: processing.
1205: If the remote server does not support the
1206: .Dv ABOR
1207: command, an
1208: .Ql ftp>
1209: prompt will not appear until the remote server has completed
1210: sending the requested file.
1211: .Pp
1212: The terminal interrupt key sequence will be ignored when
1.6 millert 1213: .Nm
1.1 deraadt 1214: has completed any local processing and is awaiting a reply
1215: from the remote server.
1216: A long delay in this mode may result from the ABOR processing described
1217: above, or from unexpected behavior by the remote server, including
1218: violations of the ftp protocol.
1219: If the delay results from unexpected remote server behavior, the local
1.6 millert 1220: .Nm
1.1 deraadt 1221: program must be killed by hand.
1222: .Sh FILE NAMING CONVENTIONS
1223: Files specified as arguments to
1.6 millert 1224: .Nm
1.1 deraadt 1225: commands are processed according to the following rules.
1226: .Bl -enum
1227: .It
1228: If the file name
1.29 aaron 1229: .Dq -
1230: is specified, the standard input (for reading)
1231: or standard output (for writing)
1232: is used.
1.1 deraadt 1233: .It
1234: If the first character of the file name is
1235: .Sq \&| ,
1236: the
1237: remainder of the argument is interpreted as a shell command.
1.6 millert 1238: .Nm
1.1 deraadt 1239: then forks a shell, using
1240: .Xr popen 3
1.29 aaron 1241: with the argument supplied, and reads (writes) from the standard output
1242: (standard input).
1.1 deraadt 1243: If the shell command includes spaces, the argument
1.29 aaron 1244: must be quoted; e.g.,
1.42 jmc 1245: .Qq ls -lt .
1.1 deraadt 1246: A particularly
1.42 jmc 1247: useful example of this mechanism is:
1248: .Qq dir |more .
1.1 deraadt 1249: .It
1.29 aaron 1250: Failing the above checks, if
1251: .Dq globbing
1252: is enabled,
1.1 deraadt 1253: local file names are expanded
1254: according to the rules used in the
1.29 aaron 1255: .Xr csh 1 ;
1.1 deraadt 1256: c.f. the
1257: .Ic glob
1258: command.
1259: If the
1.6 millert 1260: .Nm
1.29 aaron 1261: command expects a single local file (e.g.,
1262: .Ic put ) ,
1263: only the first filename generated by the
1264: .Dq globbing
1265: operation is used.
1.1 deraadt 1266: .It
1267: For
1268: .Ic mget
1269: commands and
1270: .Ic get
1271: commands with unspecified local file names, the local filename is
1272: the remote filename, which may be altered by a
1.29 aaron 1273: .Ic case ,
1.1 deraadt 1274: .Ic ntrans ,
1275: or
1276: .Ic nmap
1277: setting.
1278: The resulting filename may then be altered if
1279: .Ic runique
1280: is on.
1281: .It
1282: For
1283: .Ic mput
1284: commands and
1285: .Ic put
1286: commands with unspecified remote file names, the remote filename is
1287: the local filename, which may be altered by a
1288: .Ic ntrans
1289: or
1290: .Ic nmap
1291: setting.
1292: The resulting filename may then be altered by the remote server if
1293: .Ic sunique
1294: is on.
1295: .El
1296: .Sh FILE TRANSFER PARAMETERS
1297: The FTP specification specifies many parameters which may
1298: affect a file transfer.
1299: The
1300: .Ic type
1.42 jmc 1301: may be one of
1302: .Dq ascii ,
1303: .Dq binary ,
1304: .Dq image ,
1305: .Dq ebcdic
1306: .Pq currently not supported
1307: or
1308: .Dq tenex
1309: (local byte size 8, for PDP-10's and PDP-20's mostly).
1.6 millert 1310: .Nm
1.38 jmc 1311: supports the ASCII and image types of file transfer,
1.1 deraadt 1312: plus local byte size 8 for
1313: .Ic tenex
1314: mode transfers.
1315: .Pp
1.6 millert 1316: .Nm
1.1 deraadt 1317: supports only the default values for the remaining
1318: file transfer parameters:
1.29 aaron 1319: .Ic mode ,
1.1 deraadt 1320: .Ic form ,
1321: and
1.6 millert 1322: .Ic struct .
1.1 deraadt 1323: .Sh THE .netrc FILE
1324: The
1325: .Pa .netrc
1326: file contains login and initialization information
1327: used by the auto-login process.
1328: It resides in the user's home directory.
1329: The following tokens are recognized; they may be separated by spaces,
1330: tabs, or new-lines:
1331: .Bl -tag -width password
1332: .It Ic machine Ar name
1333: Identify a remote machine
1334: .Ar name .
1335: The auto-login process searches the
1336: .Pa .netrc
1337: file for a
1338: .Ic machine
1339: token that matches the remote machine specified on the
1.6 millert 1340: .Nm
1.1 deraadt 1341: command line or as an
1342: .Ic open
1343: command argument.
1344: Once a match is made, the subsequent
1345: .Pa .netrc
1346: tokens are processed,
1347: stopping when the end of file is reached or another
1348: .Ic machine
1349: or a
1350: .Ic default
1351: token is encountered.
1352: .It Ic default
1353: This is the same as
1354: .Ic machine
1355: .Ar name
1356: except that
1357: .Ic default
1358: matches any name.
1359: There can be only one
1360: .Ic default
1361: token, and it must be after all
1362: .Ic machine
1363: tokens.
1364: This is normally used as:
1365: .Pp
1366: .Dl default login anonymous password user@site
1367: .Pp
1368: thereby giving the user
1369: .Ar automatic
1370: anonymous ftp login to
1371: machines not specified in
1372: .Pa .netrc .
1373: This can be overridden
1374: by using the
1375: .Fl n
1376: flag to disable auto-login.
1377: .It Ic login Ar name
1378: Identify a user on the remote machine.
1379: If this token is present, the auto-login process will initiate
1380: a login using the specified
1381: .Ar name .
1382: .It Ic password Ar string
1383: Supply a password.
1384: If this token is present, the auto-login process will supply the
1385: specified string if the remote server requires a password as part
1386: of the login process.
1387: Note that if this token is present in the
1388: .Pa .netrc
1389: file for any user other
1390: than
1.29 aaron 1391: .Ar anonymous ,
1.6 millert 1392: .Nm
1.1 deraadt 1393: will abort the auto-login process if the
1394: .Pa .netrc
1395: is readable by
1396: anyone besides the user.
1397: .It Ic account Ar string
1398: Supply an additional account password.
1399: If this token is present, the auto-login process will supply the
1400: specified string if the remote server requires an additional
1401: account password, or the auto-login process will initiate an
1402: .Dv ACCT
1403: command if it does not.
1404: .It Ic macdef Ar name
1405: Define a macro.
1406: This token functions like the
1.6 millert 1407: .Nm
1.1 deraadt 1408: .Ic macdef
1409: command functions.
1410: A macro is defined with the specified name; its contents begin with the
1411: next
1412: .Pa .netrc
1413: line and continue until a null line (consecutive new-line
1414: characters) is encountered.
1415: If a macro named
1416: .Ic init
1417: is defined, it is automatically executed as the last step in the
1418: auto-login process.
1419: .El
1.6 millert 1420: .Sh COMMAND LINE EDITING
1421: .Nm
1.25 aaron 1422: supports interactive command line editing, via the
1.6 millert 1423: .Xr editline 3
1424: library.
1425: It is enabled with the
1426: .Ic edit
1.9 millert 1427: command, and is enabled by default if input is from a tty.
1.6 millert 1428: Previous lines can be recalled and edited with the arrow keys,
1429: and other GNU Emacs-style editing keys may be used as well.
1430: .Pp
1431: The
1432: .Xr editline 3
1433: library is configured with a
1434: .Pa .editrc
1.42 jmc 1435: file \- refer to
1.6 millert 1436: .Xr editrc 5
1437: for more information.
1438: .Pp
1439: An extra key binding is available to
1440: .Nm
1441: to provide context sensitive command and filename completion
1442: (including remote file completion).
1443: To use this, bind a key to the
1444: .Xr editline 3
1445: command
1446: .Ic ftp-complete .
1447: By default, this is bound to the TAB key.
1.1 deraadt 1448: .Sh ENVIRONMENT
1.6 millert 1449: .Nm
1.22 aaron 1450: utilizes the following environment variables:
1.15 millert 1451: .Bl -tag -width "FTPSERVERPORT"
1.16 millert 1452: .It Ev FTPMODE
1.29 aaron 1453: Overrides the default operation mode.
1454: Recognized values are:
1.16 millert 1455: .Bl -tag -width "passive "
1456: .It passive
1457: passive mode ftp only
1458: .It active
1459: active mode ftp only
1460: .It auto
1461: automatic determination of passive or active (this is the default)
1462: .It gate
1463: gate-ftp mode
1464: .El
1.14 millert 1465: .It Ev FTPSERVER
1466: Host to use as gate-ftp server when
1467: .Ic gate
1468: is enabled.
1469: .It Ev FTPSERVERPORT
1470: Port to use when connecting to gate-ftp server when
1471: .Ic gate
1472: is enabled.
1473: Default is port returned by a
1474: .Fn getservbyname
1.25 aaron 1475: lookup of
1.14 millert 1476: .Dq ftpgate/tcp .
1.1 deraadt 1477: .It Ev HOME
1478: For default location of a
1479: .Pa .netrc
1480: file, if one exists.
1.9 millert 1481: .It Ev PAGER
1482: Used by
1483: .Ic page
1484: to display files.
1.1 deraadt 1485: .It Ev SHELL
1486: For default shell.
1.15 millert 1487: .It Ev TMPDIR
1488: Directory to put temporary files.
1.10 millert 1489: .It Ev ftp_proxy
1490: URL of FTP proxy to use when making FTP URL requests
1491: (if not defined, use the standard ftp protocol).
1.6 millert 1492: .It Ev http_proxy
1.10 millert 1493: URL of HTTP proxy to use when making HTTP URL requests.
1.1 deraadt 1494: .El
1.36 jakob 1495: .Sh PORT ALLOCATION
1.38 jmc 1496: For active mode data connections,
1.36 jakob 1497: .Nm
1.42 jmc 1498: will listen to a random high TCP port.
1.36 jakob 1499: The interval of ports used are configurable using
1.38 jmc 1500: .Xr sysctl 8
1.36 jakob 1501: variables
1.42 jmc 1502: .Va net.inet.ip.porthifirst
1.36 jakob 1503: and
1.42 jmc 1504: .Va net.inet.ip.porthilast .
1.1 deraadt 1505: .Sh SEE ALSO
1.42 jmc 1506: .Xr basename 1 ,
1507: .Xr csh 1 ,
1508: .Xr more 1 ,
1509: .Xr stty 1 ,
1510: .Xr tar 1 ,
1.28 aaron 1511: .Xr tftp 1 ,
1.42 jmc 1512: .Xr editline 3 ,
1.14 millert 1513: .Xr getservbyname 3 ,
1.42 jmc 1514: .Xr popen 3 ,
1.6 millert 1515: .Xr editrc 5 ,
1.14 millert 1516: .Xr services 5 ,
1.34 beck 1517: .Xr ftp-proxy 8 ,
1.1 deraadt 1518: .Xr ftpd 8
1519: .Sh HISTORY
1520: The
1.6 millert 1521: .Nm
1.1 deraadt 1522: command appeared in
1523: .Bx 4.2 .
1524: .Sh BUGS
1525: Correct execution of many commands depends upon proper behavior
1526: by the remote server.
1527: .Pp
1528: An error in the treatment of carriage returns
1529: in the
1530: .Bx 4.2
1.22 aaron 1531: ASCII-mode transfer code
1.1 deraadt 1532: has been corrected.
1533: This correction may result in incorrect transfers of binary files
1534: to and from
1535: .Bx 4.2
1.22 aaron 1536: servers using the ASCII type.
1.1 deraadt 1537: Avoid this problem by using the binary image type.