blob: 493338a249d7d0a8d94cef34fa6c4e9cfd4b12ba [file] [log] [blame]
C-Kermit 8.0 Update Notes
[ [1]Contents ] [ [2]C-Kermit ] [ [3]Kermit Home ]
Second Supplement to Using C-Kermit, Second Edition
For C-Kermit 8.0
As of C-Kermit version: 8.0.211
Date of C-Kermit release: 10 April 2003
This file last updated: Sat Apr 10 16:36:11 2004
* IF YOU ARE READING A PLAIN-TEXT version of this document, note
that it is a plain-text dump of a Web page. You can visit the
original (and possibly more up-to-date) Web page here:
[4]http://www.columbia.edu/kermit/ckermit80.html
* If you are reading the HTML version of this file with a GUI Web
browser, the features added since C-Kermit 8.0.201 are shown in
red if your browser and monitor permit. Features that were new to
versions 8.0.200 and 201 are in black.
Authors: Frank da Cruz and Christine M. Gianone
Address: The Kermit Project
Columbia University
612 West 115th Street
New York NY 10025-7799
USA
Fax: +1 (212) 662-6442
E-Mail: [5]kermit-support@columbia.edu
Web: [6]http://www.columbia.edu/kermit/
Or: [7]http://www.kermit-project.org/
Or: [8]http://www.columbia.nyc.ny.us/kermit/
_________________________________________________________________
NOTICES
This document:
Copyright © 1997, 2002, Frank da Cruz and Christine M. Gianone.
All rights reserved.
Kermit 95:
Copyright © 1995, 2002, Trustees of Columbia University in the
City of New York. All rights reserved.
C-Kermit:
Copyright © 1985, 2002,
Trustees of Columbia University in the City of New York. All
rights reserved. See the C-Kermit [9]COPYING.TXT file or the
copyright text in the [10]ckcmai.c module for disclaimer and
permissions.
When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or
SSL/TLS protocol are included:
Portions Copyright © 1990, Massachusetts Institute of
Technology.
Portions Copyright © 1991, 1993 Regents of the University of
California.
Portions Copyright © 1991, 1992, 1993, 1994, 1995 by AT&T.
Portions Copyright © 1997, Stanford University.
Portions Copyright © 1995-1997, Eric Young
<eay@cryptosoft.com>.
For the full text of the third-party copyright notices, see
[11]Appendix V.
_________________________________________________________________
WHAT IS IN THIS FILE
This file lists changes made to C-Kermit since version 7.0 was
released in January 2000. Use this file as a supplement to:
* The second edition of [12]Using C-Kermit; and:
* The [13]C-Kermit 7.0 Update Notes. Also available in plain-text
form as [14]ckermit70.txt.
until the third edition of Using C-Kermit is published. We apologize
for the scattered documentation and will consolidate it when we are
able.
_________________________________________________________________
ADDITIONAL FILES Several other files accompany this new Kermit
release:
[15]ckututor.html
C-Kermit Tutorial (for Unix). Also distributed in Nroff form as
[16]ckuker.nr, the Unix C-Kermit manual page.
[17]security.htm
Discussion of Kermit's new authentication and encryption
features, updated for C-Kermit 8.0.
[18]telnet.htm
Detailed documentation of Kermit's Telnet client, updated for
C-Kermit 8.0.
[19]ftpscripts.html
Tutorial: Writing FTP automation scripts
[20]ckcbwr.html
Platform-independent C-Kermit hints and tips. Also distributed
in plain text form as [21]ckcbwr.txt
[22]ckubwr.html
Unix-specific C-Kermit hints and tips. Also distributed in
plain text form as [23]ckubwr.txt.
[24]ckvbwr.html
VMS-specific C-Kermit hints and tips. Also distributed in plain
text form as [25]ckvbwr.txt.
[26]ckuins.html
Unix C-Kermit installation instructions. Also distributed in
plain text form as [27]ckuins.txt.
[28]ckvins.html
VMS C-Kermit installation instructions. Also distributed in
plain text form as [29]ckvins.txt.
[30]ckccfg.html
Compile-time configuration options. Also distributed in plain
text form as [31]ckccfg.txt.
[32]ckcplm.html
C-Kermit Program Logic Manual. Also distributed in plain text
form as [33]ckcplm.txt.
[34]iksd.html
Internet Kermit Service Aministrators Guide for Unix.
[35]skermit.html
C-Kermit as an SSH Subsystem (SFTP server replacement).
[ [36]Top ] [ [37]C-Kermit ] [ [38]Kermit Home ]
__________________________________________________________________________
CONTENTS
[39]0. WHAT'S NEW
[40]1. FIXES SINCE VERSION 7.0.196
[41]2. SSH AND HTTP
[42]2.1. SSH Connections
[43]2.2. HTTP Connections
[44]2.2.1. HTTP Command Switches
[45]2.2.2. HTTP Action Commands
[46]2.2.3. HTTP Headers
[47]2.2.4. Secure HTTP Connections
[48]2.2.5. HTTP Variables
[49]2.2.6. The HTTP Command-Line Personality
[50]3. THE BUILT-IN FTP CLIENT
[51]3.1. Making and Managing FTP Connections
[52]3.1.1. Kermit Command-Line Options for FTP
[53]3.1.2. The FTP Command-Line Personality
[54]3.1.3. The FTP URL Interpreter
[55]3.1.4. Interactive FTP Session Establishment
[56]3.2. Making Secure FTP Connections
[57]3.3. Setting FTP Preferences
[58]3.4. Managing Directories and Files
[59]3.5. Uploading Files With FTP
[60]3.5.1. FTP PUT Switches
[61]3.5.2. Update Mode
[62]3.5.3. Recovery
[63]3.6. Downloading Files With FTP
[64]3.6.1. FTP GET Switches
[65]3.6.2. Filename Collisions
[66]3.6.3. Recovery
[67]3.7. Translating Character Sets
[68]3.7.1. Character Sets and Uploading
[69]3.7.2. Character Sets and Downloading
[70]3.8. FTP Command Shortcuts
[71]3.9. Dual Sessions
[72]3.10. Automating FTP Sessions
[73]3.10.1. FTP-Specific Variables and Functions
[74]3.10.2. Examples
[75]3.10.3. Automating Secure FTP Connections
[76]3.11. Advanced FTP Protocol Features [77]4. FILE SCANNING
[78]5. FILE AND DIRECTORY NAMES CONTAINING SPACES
[79]6. OTHER COMMAND PARSING IMPROVEMENTS
[80]6.1. Grouping Macro Arguments
[81]6.2. Directory and File Name Completion
[82]6.3. Passing Arguments to Command Files
[83]6.4. More-Prompting
[84]6.5. Commas in Macro Definitions
[85]6.6. Arrow Keys
[86]7. NEW COMMANDS AND SWITCHES
[87]8. SCRIPTING IMPROVEMENTS
[88]8.1. Performance and Debugging
[89]8.2. Using Macros as Numeric Variables
[90]8.3. New IF Conditions
[91]8.4. The ON_UNKNOWN_COMMAND and ON_CD Macros
[92]8.5. The SHOW MACRO Command
[93]8.6. Arrays
[94]8.7. New or Improved Built-in Variables and Functions
[95]8.8. The RETURN and END Commands
[96]8.9. UNDEFINing Groups of Variables
[97]8.10. The INPUT and MINPUT Commands
[98]8.11. Learned Scripts
[99]8.12. Pattern Matching
[100]8.13. Dates and Times
[101]8.14. Trapping Keyboard Interruption
[102]9. S-EXPRESSIONS
[103]9.1. What is an S-Expression?
[104]9.2. Integer and Floating-Point-Arithmetic
[105]9.3. How to Use S-Expressions
[106]9.4. Summary of Built-in Constants and Operators
[107]9.5. Variables
[108]9.6. Assignments and Scope
[109]9.7. Conditional Expressions
[110]9.8. Extensibility
[111]9.9. Examples
[112]9.10. Differences from Algebraic Notation
[113]9.11.Differences from Lisp
[114]10. FILE TRANSFER
[115]11. MODEMS AND DIALING
[116]12. TERMINAL CONNECTION
[117]13. CHARACTER SETS
[118]14. DIALOUT FROM TELNET TERMINAL SERVERS
[119]15. COPING WITH BROKEN KERMIT PARTNERS
[120]16. NEW COMMAND-LINE OPTIONS
[121]17. LOGS
[ [122]Top ] [ [123]C-Kermit ] [ [124]Kermit Home ]
__________________________________________________________________________
0. WHAT'S NEW
The Initialization and Customization Files
C-Kermit 8.0 now supports specification of the initialization
file name (path) in an environment variable, CKERMIT_INI. It
also relies far less than before on the initialization for
functioning. See [125]Section 5 of the Unix C-Kermit
[126]installation instructions for details. As of version
8.0.201, C-Kermit also executes your customization file (if you
have one) even if the initialization file was not found.
Previously, the customization file was executed by a TAKE
command in the initialization file (and it still is, if an
initialization is found).
Incompatible Changes
As always, we do our best to avoid changes that break existing
scripts. However, C-Kermit 8.0 does include a rather pervasive
syntax change that might alter the behavior of scripts that
depend on the previous behavior. As described in [127]Section
5, C-Kermit now accepts doublequotes in most contexts where you
previously had to use braces to group multiple words into a
single field, or to force inclusion of leading or trailing
blanks. Most noticeably, in C-Kermit 7.0 and earlier:
echo {this is a string}
would print:
this is a string
whereas:
echo "this is a string"
printed:
"this is a string"
In C-Kermit 8.0, both print:
this is a string
To force the doublequotes to be treated as part of the string,
use either of the following forms:
echo {"this is a string"}
echo ""this is a string""
Similarly, to force braces to be treated as part of the string:
echo "{this is a string}"
echo {{this is a string}}
Other incompatibilities:
1. Using the SET HOST command to make HTTP connections is no
longer supported. Instead, use the new HTTP OPEN command,
described in [128]Section 2.2.
C-Kermit 7.1 Alpha.01 (8 December 2000)
Its major new features are those listed in the [129]Table of
Contents: the FTP client, file scanning, command parsing and
scripting improvements, S-Expressions, and support for the
Telnet Com Port Option, plus wider availability of the
Kerberos, SSL/TLS, and SRP security options for secure Internet
connections.
C-Kermit 7.1.199 Alpha.02 (4 January 2001)
+ C-Kermit now accepts [130]FTP, TELNET, and IKSD URLs as its
first command-line argument.
+ Character-set translation added to the FTP client for
[131]filenames.
+ Optional [132]setting of date of incoming files by FTP [M]GET
from the server date.
+ [133]FTP CHECK filename added to let FTP client check the
existence of a file on the server.
+ [134]FTP GET /NAMELIST:filename added to get list of server
filenames into a local file.
+ [135]FTP [M]PUT /SERVER-RENAME:template added to make server
rename a file as indicated by the template after it has
arrived completely.
+ FTP [M]GET /SERVER-RENAME:template added to make server
rename a file as indicated by the template after it has been
sent completely.
+ FTP [136]VDIRECTORY added for getting verbose directory
listings from TOPS-20.
+ [137]FTP TYPE TENEX added for transferring 8-bit binary files
with PDP-10s.
+ Added [138]automatic text/binary mode switching for FTP
[M]GET, based on filename patterns (e.g. *.zip, *.gz, *.exe
are binary; *.txt, *.c are text).
+ [139]SET SEND I-PACKETS OFF added for coping with Kermit
servers that do not support I packets.
+ A new option was added to [140]\fword() and \fsplit() for
parsing comma-separated lists that might contain empty
elements.
+ Bug fixes including:
o {} or "" could not be used as expected to represent the
empty string.
o ,- on a line by itself in a macro definition caused
subsequent statements to be skipped.
o FTP [M]GET didn't work right if path segments were
included in the filespec.
o FTP MGET, if interrupted, did not clear its file list.
o Various problems with FTP PUT /AS-NAME that nobody
noticed.
o Some FTP messages and displays interfered with each
other.
o Parsing of YESTERDAY, TODAY, and TOMORROW in date-time
fields was broken.
o Automatic old-to-new dialing directory format conversion
was broken on VMS.
o Various source-code portability problems fixed.
+ Improvement of various HELP and SHOW messages.
C-Kermit 7.1.199 Alpha.04 (1 April 2001)
+ Big changes:
o Changed default modem type from NONE to GENERIC.
o Generic dialing now sends no init string at all.
o Changed default terminal bytesize from 7 to 8.
+ New features:
o SET SESSION-LOG TIMESTAMPED-TEXT for timestamped session
log.
+ New modem types:
o Conexant modem family
o Lucent VENUS chipset
o PCTel V.90 chipset
o Zoom V.90
o Zoom V.92
+ FTP client:
o FTP OPEN /PASSIVE and /ACTIVE switches added.
o Now works with servers that that don't include path in
NLST response.
o Fixed SEND /RECURSIVE not to follow symlinks (UNIX).
o SET FTP VERBOSE-MODE default is now OFF instead of ON.
+ Kermit protocol:
o Fixed what I hope is the last "Receive window full"
error.
o SET PREFIXING or SET CONTROL PREFIX now automatically
sets CLEARCHANNEL OFF.
o Fixed incorrect report of number of files transferred at
end of transfer.
o Fixed SEND /RECURSIVE not to follow symlinks (UNIX).
+ UNIX:
o HTTP and shadow passwords enabled for SCO 5.0.6.
o Even with SET FILENAMES CONVERTED, spaces were still
accepted in incoming filenames; now they are converted
to underscores.
o Added support for compile-time mktemp()/mkstemp()
selection.
+ VMS:
o Session-log format for scripted sessions fixed.
+ Scripting:
o Fixed \frdir() not to follow symlinks (UNIX).
o Fixed \fday() not to dump core for dates prior to 17 Mar
1858.
+ General:
o "Closing blah..." message upon exit could not be
surpressed.
o Added /PAGE and /NOPAGE to DELETE switches.
o Added GO response for DELETE /ASK (delete all the rest
without asking).
o Added GO response to "more?" prompt (for multi-page
screen output).
o Updated HELP texts.
C-Kermit 7.1.199 Beta.01 (10 May 2001)
+ FTP client verbosity adjustments.
+ Bug with generic modem dialing pausing several secs fixed.
+ SET HOST /USER:, SET LOGIN USERID, etc, fixed when given no
user ID.
+ A couple \v(dm_blah) dial modifier variables added.
+ "--version" command-line switch added.
+ Fixed NetBSD serial-port DTR handling.
+ Lots of syntax cleanups for Flexelint and gcc -Wall.
+ Fixed modem-type aliases to not take precedence over real
names.
+ Fixed funny treatment of doublequotes by ECHO command.
+ Enabled SET SESSION-LOG for VMS and other non-UNIX platorms.
+ Fixed changing direction in command history buffer.
+ Fixed handling of IKSD URLs.
+ Made sure DELETE prints a message if it got any errors.
C-Kermit 8.0.200 Beta.02 (28 June 2001)
+ Major version number increased from 7 to 8.
+ [141]SSH command.
+ More-consistent Kermit protocol defaults.
+ CONNECT idle timeout and action selection.
+ CONNECT status variable.
+ A way to allocate more space for filename lists.
+ Pseudoterminal handler fixed for late-model Linuxes.
+ Command-line option -dd for timestamped debug log.
+ Download directory now works for external protocols too.
+ GREP /COUNT:variable.
+ SET ATTRIBUTE RECORD-FORMAT { OFF, ON }.
+ Bug fixes.
C-Kermit 8.0.200 Beta.03 (9 Sep 2001)
+ [142]HTTP 1.1 connections and scripting
+ [143]ON_CTRLC macro for trapping Ctrl-C in scripts
+ [144]Date-time parsing improvements, timezones, comparison,
arithmetic
+ [145]Pattern-matching improvements
+ FTP improvements
+ SET EXIT HANGUP { ON, OFF }
+ SET FILE EOF { CTRL-Z, LENGTH }
+ ASK[Q] /TIMEOUT
+ Bug fixes
+ New platforms
C-Kermit 8.0.200 Beta.04 (16 Nov 2001)
+ [146]New Unix man page
+ [147]New Unix installation instructions
+ SET TELOPT policies are now enforced on non-Telnet ports if
the server begins Telnet negotiations.
+ SET TERMINAL IDLE-ACTION { TELNET-NOP, TELNET-AYT }.
+ UUCP lockfile creation race condition fixed.
+ Dialout, modem signals, hangup, hardware flow control, etc,
tested extensively on many platforms, numerous problems
fixed.
+ Improved hints when dialing fails.
+ SET STOP-BITS 2 can now be given without SET FLOW HARDWARE.
+ Major improvements in RFC 2217 Telnet Com-Port Control.
+ Improved ability to REDIAL a modem server port.
+ kermit -h now shows the command name in the usage usage
string.
+ kermit -h now shows ALL command-line options.
+ kermit -s blah, where blah is a symlink, now works.
+ --noperms command-line option = SET ATTRIBUTE PERMISSIONS
OFF.
+ HTTP and HTTPS URLs now supported on the command line.
+ An http command-line personality is now available.
+ Initialization file streamlined to load faster, anachronisms
removed.
+ Updated NEWS, INTRO, HELP text, SHOW commands. In particular,
see SHOW COMM, HELP SET LINE, HELP WAIT.
+ Date/time arithmetic routines converted from floating-point
to integer arithmetic (internally) for greater accuracy and
portability.
+ Quoted strings containing commas no longer break macro
execution.
+ Dynamic Kermit file-transfer timeouts are now much more
aggressive.
+ New "hot keys" to turn debug.log on/off during file transfer.
+ Improved hints when file transfer fails.
+ FTP CD orientation messages are now printed.
+ -R now accepted on the FTP command line to request Recursion.
+ -m allows Active or Passive mode to be chosen on the FTP
command line.
+ -dd on the FTP command line creates a timestamped debug.log.
+ FTP command-line security options filled in.
+ Improved automatic text/binary mode switching for MGET.
+ Removed spurious error messages that sometimes occur during
MGET.
+ DIRECTORY, GREP, TYPE, HEAD, and TAIL now have a /OUTPUT:file
option.
+ TYPE /NUMBER adds line numbers.
+ CAT = TYPE /NOPAGE; MORE = TYPE /PAGE.
+ GETOK ?-help fixed.
+ \v(timestamp) (= "\v(ndate) \v(time)")
+ \v(hour) (hour of the day, 0-23)
+ \funix2dospath() converts a UNIX path (/) to a DOS one (\).
+ \fdos2unixpath() converts a DOS (Windows, OS/2) path to a
UNIX one.
+ \fkeywordval() parses name=value pair, allows macro keyword
parameters.
+ We now make every attempt to not write passwords to the
debug.log.
+ New Certficate Authority certificates file, includes the
Kermit Project at Columbia University so you can access our
IKSD securely.
+ Secure targets improved and better documented in Unix
makefile.
+ All Linux (libc and glibc) builds consolidated under "make
linux".
+ HP-UX makefile targets now have consistent names.
+ New aix50 and aix51 targets added.
C-Kermit 8.0.200 Final (12 Dec 2001)
+ Remote/local-mode confusion on some platforms introduced in
Beta.04, fixed.
+ Many of the makefile targets adjusted, new ones added.
+ New "make install" target should please most people.
+ New command: SHOW IKSD.
+ FTP over TLS.
+ Last-minute touchups to text messages, HELP text, etc.
+ Enable modem-signal reading for SCO OSR5 and Unixware 7.
+ Special superfast TRANSMIT /BINARY /NOECHO /NOWAIT mode
added.
+ Fixed PBX dialing in unmarked-area-code case.
+ Improved SHOW COMMUNICATIONS tells lockfile directory,
typical dialout device name.
+ Some FTP OPEN command parsing problems fixed.
+ Some errors in date arithmetic fixed.
+ New command: SET TERMINAL AUTODOWNLOAD { ..., ERROR { STOP,
CONTINUE } }
+ New command: HELP FIREWALL.
+ SET MODEM HANGUP-METHOD DTR added as synomym for RS232-SIGNAL
+ Support for secure URL protocols added: telnets:, ftps:,
https:.
C-Kermit 8.0.201 (8 Feb 2002)
+ Installability as an [148]SSH v2 Subsystem.
+ [149]SET LOCUS command.
+ [150]L-versions of CD, DIR, DELETE, MKDIR, etc, to force
local execution.
+ [151]USER and ACCOUNT added as synonyms for FTP USER and FTP
ACCOUNT.
+ [152]SHOW VARIABLES now accepts a list of variables.
+ Rudimentary support for [153]Caller ID when receiving phone
calls.
+ Up/Down [154]Arrow-key navigation of command history buffer.
+ [155]Automatic execution of customization file if init file
is missing.
C-Kermit 8.0.206 Beta.01 (11 Oct 2002)
New commands:
o ORIENTATION lists location-related variables and their
values.
o KCD changes to special directories by their symbolic
names ("kcd ?" for a list).
o SET CD HOME path to specify home directory for CD and
KCD commands.
o CONTINUE given at top level is equivalent to END --
handy when PROMPT'ed out of a script, to continue the
script.
New switches or operands for existing commands:
o GETOK /TIMEOUT
o ASK, ASKQ, GETOK /QUIET (suppresses error message on
timeout)
o COPY /APPEND now allows concatenating multiple source
files into one dest file.
o SET TCP { HTTP-PROXY, SOCKS-SERVER } /USER, /PASSWORD.
o DIRECTORY command now accepts multiple filespecs, e.g.
"dir a b c".
SET QUIET ON now also applies to:
o SET HOST connection progress messages.
o "Press the X or E key to cancel" file-transfer message.
o REMOTE CD response.
o REMOTE LOGIN response.
Improvements and new features:
o Numerous FTP client fixes and new features, listed
below.
o C-Kermit, when in remote mode at the end of a file
transfer, now prints a one-line "where" message. Control
with SET TRANSFER REPORT.
o Unix makefile "install" target now creates an UNINSTALL
script.
o Improved operation and performance on RFC 2217 Telnet
connections.
o Improved CONNECT (interactive terminal connection)
performance.
o HELP text updated for many commands.
New or fixed makefile targets:
o Solaris 9 (several variations)
o Concurrent PowerMAX
o Mac OS X 10.2
o FreeBSD 1.0
o FreeBSD 4.6, 5.0
o AIX 5.2, 5.3
Bugs fixed (general):
o Failure to run in VMS Batch fixed.
o LDIRECTORY fixed to run Kermit's built-in DIRECTORY
command rather than an external one.
o Fixed Solaris and other SVORPOSIX builds to find out
their full hostnames rather than just the "uname -n"
name.
o Fixed some problems matching strings that start with
".".
o Fixed some problems matching pattern that contain
{a,b,c} lists.
o Fixed erroneous reporting of text-mode reception as
binary when sender did not report the file size
(cosmetic only).
o Many problems with SWITCH statements fixed.
o Fixed SET OPTIONS DIRECTORY /DOTFILES to work for server
too.
o Fixed DELETE to print an error message if the file was
not found.
o Fixed SET CONTROL UNPREFIX ALL and SET PREFIXING NONE to
do the same thing.
o Fixed bugs executing macros from within the ON_EXIT
macro.
o \fday() and \fnday() fixed for dates prior to 17 Nov
1858.
o Serial speed-changing bug in Linux fixed.
o "Unbalanced braces" script parsing errors when using
\{number} fixed.
o "if defined \v(name)" fixed to behave as described in
the book.
o Fixed Problems caused by LOCAL variables whose names are
left substrings of macro names.
o The INPUT command was fixed to honor the PARITY setting.
o Fixed bug with COPY to existing file that is longer than
source file.
o REINPUT command failed to strip braces/quotes around its
target string.
o Network directory lookups didn't work for SSH
connections.
o REMOTE SET { FILE, TRANSFER } CHARACTER-SET fixed.
o Closed some holes whereby an incompletely received file
was not deleted when SET FILE INCOMPLETE is DISCARD,
e.g. when the Kermit is hung up upon.
o SET XFER CHARACTER-SET TRANSPARENT fixed to do the same
as SET XFER TRANSLATION OFF.
o SET HOST PTY (e.g. SSH) connection fixed to pass along
window-size changes.
o C-Kermit search path for TAKE files was accidentally
disabled.
FTP client bugs fixed:
o Character set translation was broken on little-endian
(e.g. PC) architectures.
o FTP PUT /SERVER-RENAME:, /RENAME-TO:, /MOVE-TO: switches
were sticky.
o Make SET TRANSFER MODE MANUAL apply to FTP.
o Make SET FILE INCOMPLETE { KEEP, DISCARD } apply to FTP.
o FTP MGET /UPDATE handled equal times incorrectly.
o FTP MGET /RECOVER fixed to ignore file dates, use only
size.
o FTP MGET /RECOVER sometimes downloaded files it didn't
need to.
o FTP downloads with TRANSFER DISPLAY BRIEF could give
misleading error messages.
o FTP MGET temp file not deleted if FTP DEBUG set to OFF
after it was ON.
o LOCUS not switched back when FTP connection is lost.
o Set incoming file date even if it was not completely
received.
o FTP MGET sent SIZE and MDTM commands even when it didn't
have to.
o FTP MGET sent SIZE and MDTM commands even when it knew
they wouldn't work.
o FTP MGET failed if no files were selected for download.
o FTP MGET a* b* c* would fail to get any c*'s if no b*'s
existed.
o Big problems canceling MGET with Ctrl-C.
o Some extraneous LOCUS dialogs squelched.
o Some inconsistencies in SET FTP FILENAMES AUTO fixed.
o Fixed file-descriptor pileup after multiple MGETs when
using mkstemp().
o Fixed "mget foo", where foo is a directory name.
FTP improvements:
o New [156]FTP protocol features added (FEAT, MLSD).
o FTP MGET /RECURSIVE now works as expected if server
supports MLSD.
o FTP MGET /DATES-DIFFER to download if local and remote
file dates differ.
o FTP DATES default changed to ON.
o FTP MPUT, MGET /EXCEPT now allows up to 64 patterns (up
from 8).
o Top-level SITE and PASSIVE commands added for
convenience.
o MGET /COLLISION:APPEND /AS-NAME:newfile *.* puts all
remote files into one local file.
o SET FTP SERVER-TIME-OFFSET for when server has wrong
timezone set.
o Allow for alternative server interpretations of [M]MPUT
/UNIQUE.
o SET FTP ANONOMOUS-PASSWORD lets you specify the default
anonymous password.
o Allow "GET /RECURSIVE path/file" to force local
subdirectory creation.
o SET FTP DISPLAY is like SET TRANSFER DISPLAY but applies
only to FTP.
o FTP { ENABLE, DISABLE } new-protocol-feature-name.
o FTP MGET /NODOTFILES.
o Debug log now records FTP commands and responses in
grep-able format.
[ [157]Top ] [ [158]Contents ] [ [159]C-Kermit ] [ [160]Kermit Home ]
__________________________________________________________________________
1. FIXES SINCE VERSION 7.0.196 First, the changes from 7.0.196 to 7.0.197...
Source and makefile tweaks to get successful builds on platforms that were not
available in time for the 7.0 release:
* 4.2BSD
* 4.3BSD
* AIX 4.3
* AT&T 3B2 and 3B20
* BeOS 4.5
* CLIX
* Interactive UNIX System V/386 R3.2 V4.1.1
* OS-9/68000
* OSF/1 1.3.
* PS/2 AIX 1.2.1
* SCO OSR5.0.x
* SCO Xenix 2.3.4
* SINIX 5.41/Intel
* Stratus FTX
* Stratus VOS
* SunOS 4.1 with X.25
* Ultrix 4.2
* Unixware 2.0
There were no functional changes from 196 to 197.
Fixes applied after C-Kermit 7.0.197 was released:
Source code: Big flexelint and "gcc -Wall" audit and cleanup.
Configuration:
* Solaris RTS/CTS (hardware flow control) didn't work.
* BSDI RTS/CTS worked only in one direction.
* FreeBSD 4.0 with ncurses 5.0 broke interactive command parsing.
* QNX-32 build lacked -DBIGBUFOK so couldn't execute big macros.
Connections:
* SET HOST /PTY didn't work on some platforms.
* Broken SET HOST /USER:xxx /PASSWORD:yyy /ACCOUNT:zzz switches
fixed.
* Transparent printing was broken in Unix.
* ANSWER 0 (wait forever) didn't work.
* Some problems in Multitech modem command strings.
* Spurious "?Sorry, can't condition console terminal" errors.
* Disabling modem command strings by setting them to nothing broke
dialing.
* SET DIAL TIMEOUT value was usually ignored.
* SET DIAL METHOD PULSE didn't work.
* Certain modem commands, if changed, not refreshed if modem type
changed.
* SET SESSION-LOG command was missing from VMS.
* VMS session log format fixed for scripts.
* HANGUP by dropping DTR didn't work in NetBSD.
* SET FLOW /AUTO versus SET FLOW confusion fixed.
* Spurious secondary Solaris lockfile removed.
* SCO OSR5 DTR On/Off hangup.
* UUCP lockfile race condition.
Commands and scripts:
* Missing CAUTIOUS and FAST commands restored.
* Broken PTY command in late-model Linuxes fixed (API changed).
* Fixed off-by-one error in command recall when switching direction.
* Fixed recall of commands that contain '?'.
* COPY /SWAP-BYTES didn't work on some architectures.
* Various combinations of COPY switches didn't work.
* Various problems with COPY or RENAME with a directory name as
target.
* SHIFT didn't decrement \v(argc) if used within IF, ELSE, or SWITCH
block.
* SHIFT didn't affect the \%* variable.
* Divide by zero improperly handled in some \function()s.
* Problems with RETURN from right-recursive functions.
* FSEEK /LINE \%c LAST didn't work if already at end.
* Some buffer vulnerabilities and potential memory leaks were
discovered and fixed.
* \frdirectory() fixed not to follow symbolic links.
* SET EXIT WARNING OFF fixed to work when EXIT given in a script.
* Missing DELETE and MKDIR error message fixed.
* \fday() core dump for ancient dates fixed.
File transfer:
* SEND /COMMAND was broken.
* CRECEIVE was broken (but RECEIVE /COMMAND was OK).
* Quoting wildcard chars in filenames didn't work.
* Problems canceling streaming file transfers with X or Z.
* Problems shifting between streaming and windowing file transfer.
* Non-FULL file-transfer displays erroneously said STREAMING when
not.
* An active SEND-LIST prevented GET from working.
* SET SERVER GET-PATH interpretation of relative names like "." was
wrong.
* The MAIL command was broken.
* "kermit -s *" might have skipped some files.
* Transaction log entries were not made for external protocol
transfers.
* File count report fixed to show number of files actually
transferred.
* Fixed filename conversion to convert spaces to underscores.
* Made SET PREFIXING / SET CONTROL PREFIX also adjust CLEARCHANNEL.
* More "Receive window full" errors fixed.
* Broken terminal buffering after curses display in Solaris fixed.
* SET FILE INCOMPLETE DISCARD did not work in all cases.
* Packet log changed to reformat the start-of-packet character
printably.
* Dynamic timeouts could grow ridiculously large.
Character sets:
* Hebrew-7 translations missed the letter Tav.
* C1 area of CP1252 was ignored.
* SET TRANSFER CHARACTER-SET TRANSPARENT could give garbage
translations.
* TRANSLATE might not work on Little Endian architectures.
* Insufficient range checking in certain TRANSLATE operations.
The following bugs in C-Kermit 8.0.200 were fixed in 8.0.201:
* An obscure path through the code could cause the Unix version of
C-Kermit to dump core during its startup sequence. This happened
to only one person, but now it's fixed.
* When C-Kermit 8.0 is in Kermit server mode and the client says
"get blah", where blah (on the server) is a symlink rather than a
real file, the server unreasonably refused to send the linked-to
file.
* When C-Kermit is an FTP client and says "get foo/bar" (i.e. a
filename that includes one or more path segments), it failed to
accept the incoming file (this happened only with GET, not MGET).
* Array references should be case insensitive but only lowercase
array letters were accepted.
* SHOW VARIABLES dumped core on \v(sexpression) and \v(svalue).
* Spurious refusals of remote directory listings if the remote
server's date was set in the past.
* In AIX, and maybe elsewhere too, Kermit's COPY command always
failed with "Source and destination are the same file" when the
destination file didn't exist.
* The VMS version of C-Kermit did not work in Batch or when SPAWN'd.
To compound the problem, it also pretty much ignored the -B and -z
command-line options, whose purpose is to work around such
problems.
* C-Kermit 8.0 could not be built on IRIX 5.x.
* The C-Kermit 8.0 build for QNX6 said it was an "(unknown
version)".
Other fixes are listed in the [161]previous section.
[ [162]Top ] [ [163]Contents ] [ [164]C-Kermit ] [ [165]Kermit Home ]
__________________________________________________________________________
2. SSH AND HTTP
2.1. SSH Connections
This section does not apply to [166]Kermit 95 2.0, which has its
own built-in SSH client, which is documented [167]SEPARATELY.
On most UNIX platforms, C-Kermit can make SSH (Secure SHell)
connection by running the external SSH command or program through its
pseudoterminal interface. The command is:
SSH text
Tells Kermit to start the external SSH client, passing the
given text to it on the command line. Normally the text is just
the hostname, but it can be anything else that is acceptable to
the ssh client. If the command succeeds, the connection is made
and Kermit automatically enters CONNECT (terminal) mode. You
can use the SSH command to make a connection to any host that
has an SSH server.
Kermit's SSH command gives you all the features of Kermit on an SSH
connection: command language, file transfer, character-set
translation, scripting, and all the rest. By default, C-Kermit invokes
SSH with "-e none", which disables the ssh escape character and makes
the connection transparent for purposes of file transfer. You can,
however, change the SSH invocation to whatever else you might need (an
explicit path, additional command-line arguments, etc) with:
SET SSH COMMAND text
Specifies the system command that Kermit's SSH command should
use to invoke the external SSH client. Use this command to
supply a specific path or alternative name, or to include
different or more command-line options.
In most cases, these connections work quite well. They can be scripted
like any other connection, and file transfer goes as fast as, or
faster than, on a regular Telnet connection. In some cases, however,
the underlying pseudoterminal driver is a limiting factor, resulting
in slow or failed file transfers. Sometimes you can work around such
problems by reducing the Kermit packet length. Note that Kermit does
not consider SSH connections to be reliable, so it does not offer to
use streaming in Kermit protocol transfers (but you can force it with
SET RELIABLE or SET STREAMING if you wish).
The SSH command is like the TELNET command: it enters CONNECT mode
automatically when the connection is made. Therefore, to script an SSH
connection, use:
set host /pty ssh -e none [ other-options ] host
if fail ...
to make the connection.
Here's a sequence that can be used to make a connection to a given
host using Telnet if the host accepts it, otherwise SSH:
if not defined \%1 exit 1 Usage: \%0 host
set quiet on
set host \%1 23 /telnet
if fail {
set host /pty ssh -l \m(user) -e none \%1
if fail exit 1 \%1: Telnet and SSH both fail
echo SSH connection to \%1 successful
} else {
echo Telnet connection to \%1 successful
}
In SSH v2, it is possible to make an SSH connection direct to a Kermit
server system if the host administrator has configured the SSH server
to allow this; [168]CLICK HERE for details.
Since Kermit uses external ssh client software, and since there are
different ssh clients (and different releases of each one), the exact
command to be used to make an SSH/Kermit connection can vary. Here is
the command for the OpenSSH 3.0.2p1 client:
set host /pipe ssh -e none [ -l username ] -T -s hostname kermit
Example:
set host /pipe ssh -e none -l olga -T -s hq.xyzcorp.com kermit
The SSH client might or might not prompt you for a password or other
information before it makes the connection; this depends on your SSH
configuration (your public and private keys, your authorized hosts
file, etc). Here's a brief synopsis of the OpenSSH client command
syntax ("man ssh" for details):
-e none
This tells the SSH client to use no escape character. Since we
will be transferring files across the connection, we don't want
the connection to suddenly block because some character in the
data.
-l username
This is the username on the remote host. You can omit the -l
option and its argument if your local and remote usernames are
the same. If they are different, you must supply the remote
username.
-T
This tells the SSH client to tell the SSH server not to
allocate a pseudoterminal. We are not making a terminal
connection, we don't need a terminal, and in fact if a terminal
were allocated on the remote end, the connection would not
work.
-s ... kermit
This tells the SSH client to tell the SSH server to start the
specified subsystem ("kermit") once the connection is made. The
subsystem name comes after the hostname.
hostname
The IP host name or address of the desired host.
You might want to include other or additional ssh command-line
options; "man ssh" explains what they are. Here are some examples for
the OpenSSH 3.0.2p1 client:
-oClearAllForwardings yes
-oForwardAgent no
-oForwardX11 no
-oFallbackToRsh no
These ensure that a secure connection is used and that the
connection used for file transfer is not also used for
forwarding other things that might be specified in the
ssh_config file.
-oProtocol 2
(i.e. SSH v2) Ensures that the negotiated protocol supports
subsystems.
Once you have an SSH connection to a Kermit server, it's just like any
other connection to a Kermit server (and very similar to a connection
to an FTP server). You give the client file transfer and management
commands for the server, and the server executes them. Of course you
can also give the client any other commands you wish.
[ [169]SSH Kermit Server Subsystem ] [ [170]Kermit 95 Built-in SSH
Client ]
_________________________________________________________________
2.2. HTTP Connections
Hypertext Transfer Protocol, or HTTP, is the application protocol of
the World Wide Web (WWW), used between Web browsers (clients) and Web
servers. It allows a client to get files from websites, upload files
to websites, delete files from websites, get information about website
directories and files, and interact with server-side CGI scripts.
C-Kermit includes an HTTP client capable of both clear-text and secure
HTTP connections, that can do all these tasks and can be automated
through the Kermit scripting language.
Although C-Kermit 7.0 could make HTTP connections to Web servers, it
could do so only when no other connection was open, and the procedure
was somewhat awkward. C-Kermit 8.0 improves matters by:
* Allowing an HTTP connection to be open at the same time as a
regular SET LINE or SET HOST connection, and also at the same time
as an FTP connection ([171]Section 3);
* Upgrading the HTTP protocol level from 1.0 to 1.1, thus allowing
for persistent connections, in which a series of commands can be
sent on the same connection, rather than only one as in HTTP 1.0
(and C-Kermit 7.0);
* Providing for "one-shot" URL-driven HTTP operations such as GET or
PUT.
* Providing a distinct HTTP command-line personality.
Persistent HTTP connections are managed with the following commands:
HTTP [ switches ] OPEN [ security-options ] host-or-url [ port ]
Opens a persistent connection to the specified host (IP host
name or address) on the specified port. If any switches
(options, listed in the next section) are included, their
values are saved and used for all subsequent HTTP action
commands on the same connection. If no port is specified, HTTP
(80) is used. A Uniform Resource Locator (URL, [172]RFC 1738)
can be given instead of a hostname (or address) and port (but
the URL can not include a directory/file path). The security
options are explained [173]below. The HTTP OPEN command
replaces the C-Kermit 7.0 SET HOST hostname HTTP command, which
no longer works with HTTP GET and related commands.
HTTP CLOSE
Closes any open HTTP connection and clears any saved switch
values.
A URL starts with a protocol name, which must be http or https in this
case; optionally includes a username and password; and must contain a
host name or address:
protocol://[user[.password]]@host[:port][URI]
HTTP is Hypertext Transfer Protocol. HTTPS is the secure (SSL/TLS)
version of HTTP. The TCP service port is derived from the protocol
prefix (so normally the ":port" field is omitted). Thus the URL
protocol name specifies a default TCP service port and the URL user
and password fields can take the place of the /USER and /PASSWORD
switches ([174]Section 2.2.1). The optional URI is a "compact string
of characters for identifying an abstract or physical resource"
([175]RFC 2396), such as a file. It must begin with a slash (/); if
the URI is omitted, "/" is supplied. Examples:
http open http://www.columbia.edu/
Equivalent to http open www.columbia.edu or http open
www.columbia.edu http.
http open https://olga.secret@www1.xyzcorp.com/
Equivalent to http /user:olga /pass:secret open
www1.xyzcorp.com https.
Persistence is accomplished unilaterally by C-Kermit 8.0. An HTTP 1.0
server closes the connection after each action. Although HTTP 1.1
allows multiple actions on the same connection, an HTTP 1.1 server
tends to close the connection if it is idle for more than a few
seconds, to defend itself against denial-of-service attacks. But when
you use Kermit's HTTP OPEN command to create a connection, Kermit
reopens it automatically (if necessary) for each HTTP action until you
close it with HTTP CLOSE, regardless of the server's HTTP protocol
version, or how many times it closes the connection.
Firewalls can be negotiated through proxies with the following
commands:
SET TCP HTTP-PROXY [ host[:port] ]
If a host (by hostname or IP address) is specified, Kermit uses
it as a proxy server when attempting outgoing TCP connections
-- not only HTTP connections, but all TCP/IP connections,
Telnet and FTP included. This allows Kermit to adapt to the
HTTP firewall penetration method (as opposed to other methods
such as SOCKS4). If no hostname or ip-address is specified, any
previously specified Proxy server is removed. If no port number
is specified, the "http" service is used. This command must be
given before the HTTP OPEN command if a proxy is to be used or
canceled.
HTTP [ switches ] CONNECT host[:port]
Instructs the HTTP server to act as a proxy, establishing a
connection to the specified host (IP hostname or address) on
the given port (80 = HTTP by default) and to redirect all data
transmitted between Kermit and itself to the given host for the
life of the connection. This command is to be used only for
debugging HTTP proxy connections. If a proxy connection is
required, instruct Kermit to use the proxy with the SET TCP
HTTP-PROXY command.
2.2.1. HTTP Command Switches
HTTP switches, like all other switches, are optional. When HTTP
switches are included with the HTTP OPEN command, they apply
automatically to this and all subsequent HTTP actions (GET, PUT, ...)
on the same connection until an HTTP CLOSE command is given. So if you
include switches (or the equivalent URL fields, such as user and
password) in the HTTP OPEN command, you can omit them from subsequent
commands on the same connection. If the connection has closed since
your last command, it is automatically reopened with the same options.
If you include switches with an HTTP action command (such as GET or
PUT), they apply only to that command.
/USER:name
To be used in case a page requires a username for access. The
username is sent with page requests. If it is given with the
OPEN command it is saved until needed. If a username is
included in a URL, it overrides the username given in the
switch. CAUTION: Username and password (and all other
information, including credit card numbers and other material
that you might prefer to protect from public view) are sent
across the network in clear text on regular HTTP connections,
but authentication is performed securely on HTTPS connections.
/PASSWORD:text
To be used in case a web page requires a password for access.
The password is sent with page requests. If it is given with
the OPEN command it is saved until needed. If a password is
given in a URL, it overrides the one given here. CAUTION: (same
as for /USER:).
/AGENT:user-agent
Identifies the client to the server. Overrides the default
agent string, which is "C-Kermit" (for C-Kermit) or "Kermit-95"
(for Kermit 95).
/ARRAY:array-designator
Tells Kermit to store the response headers in the given array,
one line per element. The array need not be declared in
advance. Example: /array:&a.
/TOSCREEN
Tells Kermit to display any response text on the screen. It
applies independently of the output file specification; thus it
is possible to have the server response go to the screen, a
file, both, or neither.
/HEADER:header-item(s)
Used for specifying any optional headers to be sent with HTTP
requests.
/HEADER:tag:value
To send more than one header, use braces for grouping:
/HEADER:{{tag:value}{tag:value}...}
For a list of valid tags and value formats see [176]RFC 2616,
"Hypertext Transfer Protocol -- HTTP/1.1". A maximum of eight
headers may be specified.
2.2.2. HTTP Action Commands
HTTP actions can occur within a persistent connection, or they can be
self-contained ("connectionless"). A persistent HTTP connection begins
with an HTTP OPEN command, followed by zero or more HTTP action
commands, and is terminated with an HTTP CLOSE command:
http open www.columbia.edu
if failure stop 1 HTTP OPEN failed: \v(http_message)
http get kermit/index.html
if failure stop 1 HTTP GET failed: \v(http_message)
(more actions possible here...)
http close
A self-contained HTTP action occurs when a URL is given instead of a
remote file name to an HTTP action command. In this case, Kermit makes
the HTTP connection, takes the action, and then closes the connection.
If an HTTP connection was already open, it is closed silently and
automatically.
http get http://www.columbia.edu/kermit/index.html
Kermit's HTTP action commands are as follows. Switches may be included
with any of these to override switch (or default) values given in the
HTTP OPEN command.
HTTP [ switches ] GET remote-filename [ local-filename ]
Retrieves the named file from the server specified in the most
recent HTTP OPEN command for which a corresponding HTTP CLOSE
command has not been given. The filename may not include
wildcards (HTTP protocol does not support them). If no HTTP
OPEN command is in effect, this form of the HTTP GET command
fails. The default local filename is the same as the remote
name, but with any pathname stripped. For example, the command
http get kermit/index.html stores the file in the current local
directory as index.html. If the /HEADERS: switch is included,
information about the file is also stored in the specified
array (explained in [177]Section 2.2.3). All files are
transferred in binary mode. HTTP does not provide for
record-format or character-set conversion.
HTTP [ switches ] GET url [ local-filename ]
When HTTP GET is given a URL rather than a filename, Kermit
opens a connection to the designated server (closing any
previously open HTTP connection), gets the file, and then
closes the connection. If the URL does not include a filename,
index.html is supplied. This is the self-contained one-step
"connectionless" method for getting a file from a Web server.
The data is not interpreted; HTTP GET is like "lynx -source"
rather than "lynx -dump".
In the remaining HTTP action commands, the distinction between a
remote filename and a URL are the same as in the HTTP GET command.
HTTP [ switches ] HEAD remote-filename-or-url [ local-filename ]
Like GET except without actually getting the file; instead it
retrieves only the headers. If the /ARRAY: or /TOSCREEN switch
is included, there is no default local output filename but you
can still specify one. If neither of these switches is
included, the default local filename is the same as the remote
filename, but with any path stripped and with ".head" appended.
The HEAD command can be used in a script with the /ARRAY:
switch to retrieve information about the requested resource to
determine whether the resource should actually be retrieved
with a subsequent GET request.
HTTP [ switches ] INDEX remote-directory-or-url [ local-filename ]
Asks the server to send a listing of the files in the given
server directory. This command is not supported by most Web
servers. Even when it is supported, there is no standard format
for the listing.
HTTP [ switches ] POST [ /MIME-TYPE:type ] source-file
remote-path-or-url [ result-file ]
Sends data to a process running on the remote host; the result
is usually an HTML file but could be anything. The data to be
posted must be read from a local file (the source-file). If a
result file is specified, Kermit stores the server's response
in it.
HTTP [ switches ] PUT [ MIME-TYPE:type ] local-file [
remote-file-or-url [ result-file ] ]
Uploads a local file to the server. Only the name of a single
file can be given; wildcards (and group transfers) are not
supported by HTTP protocol. If no remote filename is given, the
file is sent with the same name as the local file, but with any
pathname stripped.
HTTP [ switches ] DELETE remote-file-or-url [ local-result-file ]
Asks the server to delete the specified single file. If a
result file is specified, it will contain any response data
returned by the server.
Note the limitations of HTTP protocol compared to (say) FTP or Kermit.
There is no command for changing directories, no standard way to get
file or directory lists, no way to transfer file groups by using
wildcard notation, etc, and therefore no good way to (say) fetch all
pages, descend through subdirectories, perform automatic updates, etc.
There is no assurrance a connection will stay open and, as noted,
there is no provision for data conversion between unlike platforms.
The data's MIME headers can be used for postprocessing.
2.2.3. HTTP Headers
Each HTTP request and response contains a set of name/value pairs
called headers. HTTP headers are specified in [178]RFC 2616. For
example, an HTTP GET request for /index.html on www.columbia.edu
contains the following headers:
GET /index.html HTTP/1.1
Host: www.columbia.edu:80
User-agent: C-Kermit 8.0
Authorization: Basic base64-encoded-username-password
These might be followed by any others specified with a /HEADERS:
switch:
Accept: image/gif, image/x-xbitmap, image/jpeg, *.*
Accept-Encoding: gzip
Accept-Language: en
Accept-Charset: iso-8859-1,utf-8
Cookie: cookie-data
The server sends back a short report about the file prior to sending
the file contents. Example:
HTTP/1.1 200 OK
Date: Fri, 24 Aug 2001 21:09:39 GMT
Server: Apache/1.3.4 (Unix)
Last-Modified: Mon, 06 Aug 2001 21:16:13 GMT
ETag: "1fa137-10d7-3b6f091d"
Accept-Ranges: bytes
Content-Length: 4311
Content-Type: text/html
If you want to have this information available to a Kermit script you
can use the /ARRAY switch to have Kermit put it in array, one line per
array element. Example:
set exit warning off
http open www.columbia.edu
if fail exit 1 Can't reach server
http /array:&a get /index.html
if fail exit 1 Can't get file
echo Header lines: \fdim(&a)
for \%i 1 \fdim(&a) 1 {
echo \%i. \&a[\%i]
}
Note that the "Date:" item is the current date and time; the
"Last-Modifed:" item is the file's modification date and time. An
example showing how to use this information is presented in
[179]Section 8.13.7.
2.2.4. Secure HTTP Connections
SSL/TLS (Secure Sockets Layer / Transport Layer Security) is the
protocol used to secure HTTP, SMTP, and other Internet applications.
See the [180]C-Kermit Reference Section 5.4 for an introduction to
SSL/TLS. To make a secure HTTP connection, you need:
1. A secure client (a version of C-Kermit or Kermit 95 with SSL/TLS
security built in). Type "check ssl" at the Kermit prompt to make
sure you have it.
2. A secure server to connect to.
3. The CA Root Certificate used to authenticate the server to the
client. (see [181]Section 15 of the security reference for an
introduction to certificates).
And you must make a connection to the secure HTTP port: service name
HTTPS, port number 443 (as opposed to service HTTP, port 80). You can
also make secure connections to other ports by including the /TLS or
/SSL switch with the HTTP OPEN command, if the host supports SSL/TLS
on the given port:
The quality of the SSL/TLS connection depends on the cipher suite.
There are several possibilities:
Anonymous cipher suite:
If an anonymous cipher suite is negotiated, the connection is
encrypted but there is no authentication. This connection is
subject to a Man-In-The-Middle (MITM) attack.
X.509 certificate on the server:
When you connect to certain secure servers, an X.509
certificate is returned. This certificate is issued to a
special hostname, something like www1.xyzcorp.com or
wwws.xyzcorp.com (rather than the normal www.xyzcorp.com). It
is signed by the host's Certificate Authority (CA). If the host
certificate is configured on the client, it can be used to
verify the certificate received from the server. If the
certificate it verified as authentic, a check is made to ensure
it has not expired and it was issued to the host you were
attempting to connect to. If you had asked to connect to (say)
www.xyzcorp.com but were given a certificate for
www1.xyzcorp.com, you would be prompted for permission to
continue.
If the verification succeeded, the connection would be
encrypted with one-way (server-to-client) authentication. This
connection is not subject to a MITM attack.
If a username and password are transmitted over this
connection, they are not subject to interception. However, the
standard risks associated with passing the password to the host
for verification apply; for example, if the host has been
compromised, the password will be compromised.
X.509 client certificate:
If a connection has been established with an X.509 server
certificate, the server can ask the client to send a
certificate of its own. This certificate must be verified
against a CA Root certificate. The certificate itself (or
subject info from the certificate) is used to determine the
authorization for the client, and if successful, the username
and password need not be sent to the server.
Kerberos 5:
Instead of using X.509 certifcates, Kerberos 5 can be used to
perform the authentication and key exchange. In this situation,
there is mutual authentication between the client and server.
The Kerberos 5 principal is used by the server to look up the
appropriate authorization data. There is no need to send
username and password.
An HTTP connection is made with the HTTP OPEN command:
HTTP [ switches ] OPEN [ { /SSL, /TLS } ] host [ port ]
If /SSL or /TLS switches are included (these are synonyms), or
if the service is HTTPS or the port is 443, a secure connection
is attempted using the current authentication settings; see
HELP SET AUTHENTICATION for details ([182]Section 6.2 of the
security reference). If the no /SSL or /TLS switch is included
but the port is 443 or the service is HTTPS, a secure
connection is attempted. If an /SSL or /TLS switch is included
but a port is not specified, an SSL/TLS connection is attempted
on the default port (80).
Certificates are covered in the separate [183]Kermit Security
Reference for C-Kermit 8.0. You should let Kermit know to verify
certificates with the SET AUTHENTICATION TLS command. For example:
SET AUTHENTICATION TLS CRL-DIR directory
Specifies a directory that contains certificate revocation
files where each file is named by the hash of the certificate
that has been revoked.
SET AUTHENTICATION TLS CRL-FILE filename
Specifies a file that contains a list of certificate
revocations.
SET AUTHENTICATION TLS VERIFY-DIR directory
Specifies a directory that contains root CA certificate files
used to verify the certificate chains presented by the peer.
Each file is named by a hash of the certificate.
SET AUTHENTICATION TLS VERIFY-FILE filename
Specifies a file that contains root CA certificates to be used
for verifying certificate chains.
SET AUTHENTICATION TLS VERIFY OFF
Tells Kermit not to require a certificate and accept any
certificate that is presented regardless of whether it is
valid.
There are many other options; see the security document for details.
Now suppose you need need to fetch the file denoted by the following
URL:
https://myuserid:mypassword@wwws.xyzcorp.com/clients/info/secret.html
Once you have set up the handling of certificates as desired, you can
use the following Kermit commands:
http /user:myuserid /password:mypassword open www1.xyzcorp.com https
if success {
http get /clients/info/secret.html
http close
}
As another example, let's say that you have a web form you need to
populate with three fields: red,white and blue.
<FORM ACTION="http://www.xyzcorp.com/cgi-bin/form.cgi" METHOD="POST">
<INPUT NAME="Red">
<INPUT NAME="White">
<INPUT NAME="Blue">
</FORM>
You can handle this with the HTTP POST command. The data to be posted
is stored in the local file data.txt.
Red=seven stripes&White=six stripes&Blue=fifty stars
and the response from the server will be stored into response.txt.
http open www.xyzcorp.com http
if success {
http /array:c post data.txt /cgi-bin/form.cgi response.txt
http close
}
In this scenario, the Common Gateway Interface (CGI) sends a response
whether it succeeds or fails in a script-dependent manner. The script
can either report success and enclose the response data; or it might
send a 302 Found error which indicates that the "Location:" header
should be used to determine the URL at which the data can be found.
2.2.5. HTTP Variables
\v(http_code)
The HTTP protocol code number of the most recent server reply,
e.g. 404 for "not found".
\v(http_connected)
1 when an HTTP connection is open, 0 when there is no HTTP
connection.
\v(http_host)
If an HTTP connection is open, the hostname:port, e.g.
www.columbia.edu:80; otherwise, empty.
\v(http_message)
Server error message, if any, from most recent HTTP command.
\v(http_security)
A list of the security parameters and values for the current
connection, if any. Empty if the connection is not to a secure
server, or there is no connection.
To display all the HTTP variables at once, type SHOW VAR HTTP:
C-Kermit> http open www.columbia.edu
C-Kermit> http get lkjlkjlkjlkj
C-Kermit> sho var http
\v(http_code) = 404
\v(http_connected) = 1
\v(http_host) = www.columbia.edu:80
\v(http_message) = Not Found
\v(http_security) = NULL
C-Kermit>
2.2.6. The HTTP Command-Line Personality
If you invoke C-Kermit with the name "http" or "https", you can use a
special set of HTTP-specific command-line options. You can do this by
creating a symbolic linke "http" or "https" to the C-Kermit 8.0
executable, or by having a separate copy of it called "http" or
"https". Here's the usage message ("http -h"):
Usage: ./http host [ options... ]
-h This message.
-d Debug to debug.log.
-S Stay (issue command prompt when done).
-Y Do not execute Kermit initialization file.
-q Quiet (suppress most messages).
-u name Username.
-P password Password.
-g pathname Get remote pathname.
-p pathname Put remote pathname.
-H pathname Head remote pathname.
-l pathname Local path for -g, -p, and -H.
-z opt[=value] Security options...
cert=file Client certificate file
certsok Accept all certificates
key=file Client private key file
secure Use SSL
verify=n 0 = none, 1 = peer , 2 = certificate required
The "host" argument is the name of a Web host, e.g. www.columbia.edu.
The action options are -p, -g, and -H. If you give an action option,
Kermit does the action and then exits. If you give a host without an
action option, Kermit makes an HTTP connection to the host and then
gives you the C-Kermit prompt. Here's a simple example that fetches a
publicly readable Web page:
http www.columbia.edu -g kermit/index.html
If you need to access a website for which a username and password are
required, you can supply them on the command line with -u and -P. If
you include a username but omit the password, Kermit prompts you for
it:
http www.columbia.edu -u olga -p kermit/index.html -l index.html
Password:
Note that when PUT'ing files to websites, you have to supply both the
-p (remote pathname) and -l (local path) options.
If your version of Kermit is built with SSL/TLS security, you can also
use the -z option to make secure HTTP (https) connections.
Finally, as noted in [184]Section 16, you can also give a URL instead
of a host name and options.
[ [185]Top ] [ [186]Contents ] [ [187]C-Kermit Home ] [ [188]Kermit
Home ]
__________________________________________________________________________
3. THE BUILT-IN FTP CLIENT
3.1. [189]Making and Managing FTP Connections
3.2. [190]Making Secure FTP Connections
3.3. [191]Setting FTP Preferences
3.4. [192]Managing Directories and Files
3.5. [193]Uploading Files With FTP
3.6. [194]Downloading Files With FTP
3.7. [195]Translating Character Sets
3.8. [196]FTP Command Shortcuts
3.9. [197]Dual Sessions
3.10. [198]Automating FTP Sessions
3.11. [199]Advanced FTP Protocol Features
Earlier versions of C-Kermit and K95 included an FTP command, but it
simply invoked an external FTP client. Now, by popular demand, Kermit
includes its own built-in FTP client that offers the following
advantages over traditional FTP clients (and its previous interface to
them):
* Any of Kermit's built-in [200]security methods can be used to
establish and conduct secure FTP sessions with [201]FTP servers
that support these methods. (Security modules can be subject to
export restrictions.)
* Kermit's FTP client uses "passive mode" by default to avoid
blockage by firewalls and network address translators. Of course
active mode can be chosen too when needed.
* [202]Character sets can be translated as part of the transfer
process even when the FTP server does not support character-set
translation, including to/from the new Internet standard
international character set, [203]Unicode UTF-8. This includes
both the file's name and (for text files only) its contents.
* All of C-Kermit's [204]file-selection mechanisms are available:
size, date, name patterns and lists, exception lists, etc.
* [205]Atomic file movement capabilities are provided (delete, move,
or rename files automatically after successful transfer).
* The correct file type, "ascii" (i.e. text) or binary, is chosen
automatically for each file (explained in [206]Section 4), and any
mixture of text and binary files can be sent in a single
operation, even across platforms.
* Update mode ("don't bother transferring files that didn't change
since last time") and recovery (resumption of an interrupted
transfer from the point of failure) are available in both
directions.
* When uploading files from UNIX to UNIX, the file's permissions can
be preserved if desired.
* Recursive directory-tree PUTs are supported between any two
platforms that have tree-structured file systems. Recursive GETs
are supported between like platforms if the server cooperates and
between like or unlike platforms if the server supports MLSD
([207]Section 3.11).
* When receiving files, all of Kermit's file collision actions are
available: backup, update, refuse, rename, etc.
* Multi-file transfers can be interrupted on a per-file basis,
automatically skipping to the next file.
* FTP sessions are [208]fully scriptable.
* An entire FTP session (connect, login, CD, upload or download,
logout) can be specified on the command line without using a
script.
* All of Kermit's logging options and formats are available to keep
an accurate and complete record of each connection and file
transfer, and to aid in troubleshooting.
* All of Kermit's file-transfer display options are available
(fullscreen, brief, CRT, serial, none).
And best of all:
* Kermit doesn't give you those annoying per-file prompts every time
you start a multi-file transfer without remembering to give a
"prompt" command first :-).
[ [209]Top ] [ [210]FTP Top ] [ [211]FTP Client Overview ] [ [212]FTP
Script Tutorial ] [ [213]C-Kermit Home ] [ [214]Kermit Home ]
_________________________________________________________________
3.1. Making and Managing FTP Connections
Each copy of Kermit can have one FTP connection open at a time. FTP
connections are independent of regular terminal connections; a
terminal connection (serial or network via SET LINE, DIAL, SET HOST,
TELNET, etc) may be, but need not be, open at the same time as an FTP
connection, and terminal connections can also be closed, and new
connections opened, without interfering with the FTP connection (and
vice versa). Thus, for example, Kermit can have an FTP connection and
a TELNET connection open to the same host simultaneously, using the
TELNET connection (e.g.) to send mail or take other desired actions as
various FTP actions complete. Of course, each copy of Kermit can do
only one thing at a time, so it can't (for example) transfer a file
with FTP and another file with Kermit protocol simultaneously.
A Kermit FTP session can be established by [215]command-line options,
by [216]URL, or by [217]interactive commands.
3.1.1. Kermit Command-Line Options for FTP
The new command-line option '-9' (sorry, we're out of letters) can be
used when starting C-Kermit, telling it to make an FTP connection:
kermit -9 hostname
or if a non-default FTP port is needed:
kermit -9 hostname:port
You can also specify the username on the command line with the -M ("My
User ID") option that was already there for other connection types:
kermit -9 hostname -M olga
If you specify the username on the command line, Kermit uses it when
making the connection and does not prompt you for it (but it does
prompt you for the password if one is required).
Once the connection is made, you get the regular Kermit prompt, and
can give interactive commands such as the ones described below. When
you give a BYE command, Kermit closes the session and exits, just as a
regular FTP client would do. If you don't want Kermit to exit when you
give a BYE command, include the -S ("Stay") option on the command
line.
Other Kermit command-line options that are not specific to non-FTP
connections should affect the FTP session in the expected ways; for
example, -i and -T force binary and text mode transfers, respectively.
File transfers can not be initiated on the "kermit -9" command line;
for that you need to use Kermit's FTP personality (next section) or
you can use URLs ([218]Section 3.1.3).
_________________________________________________________________
3.1.2. The FTP Command-Line Personality
If you want to replace your regular FTP client with C-Kermit, you can
make a link called "ftp" to the C-Kermit binary (or you can store a
copy of the C-Kermit binary under the name "ftp"). When C-Kermit is
invoked with a program name of "ftp" (or "FTP", case doesn't matter),
it assumes the command-line personality of the regular FTP client:
ftp [ options ] hostname [ port ]
In this case the options are like those of a regular FTP client:
-d Debug: enables debug messages and creates a debug.log file.
-n No autologin: Kermit should not send your user ID automatically.
-t Packet trace: accepted but is treated the same as -d.
-v Verbose: accepted but ignored (operation is verbose by default).
-i Not interactive: accepted but ignored.
and the hostname can also be a URL (explained in [219]Section 3.1.3).
To specify a non-default TCP port for the FTP server, include the port
number or name after the hostname.
There are also some bonus options that allow you to execute an entire
FTP session from the shell command line, as long as you don't include
the -n option. These are not available with regular FTP clients, and
at least one of these options (-g) conflicts with UNIX ftp (where -g
means "no globbing", which does not apply to Kermit), and some of them
(like the options above) also conflict with regular Kermit
command-line options:
-m mode = "passive" (default) or "active"
-Y Don't execute the Kermit initialization file [1]
-q Quiet, suppresses all but error messages [1]
-S Stay, don't exit automatically [1]
-A Autologin anonymously [2]
-u name Username for autologin [2] (synonym: -M [1])
-P password Password for autologin (see cautions below) [2]
-D directory cd after autologin [2]
-b Binary mode [2]
-a Text ("ascii") mode [2] (synonym: -T [1])
-R Recursive (works with -p) [4]
-p files Files to put (upload) after autologin [2] (synonym: -s [1])
-g files Files to get (download) after autologin [3]
[1] Same as Kermit, not available in regular FTP clients.
[2] Conflicts with Kermit, not available in regular FTP clients.
[3] Same as Kermit, conflicts with regular FTP clients.
[4] Conflicts with Kermit, available in some FTP clients.
Fancier options such as restart, character-set translation, filename
collision selection, automatic move/rename/delete, etc, are not
available from the command line; for these you can use the commands
described in the following sections. The -R option might also work
with -g (GET) but that depends on the server.
The following security options are also available, explained in
[220]Section 3.2:
-k realm Kerberos 4 realm [4]
-f Kerberos 5 credentials forwarding [4]
-x autoencryption mode [4]
-c cipher SRP cipher type [4]
-H hash SRP encryption hash [4]
-z option Security options [4]
If you include -A or specify a name of "anonymous" or "ftp", you are
logged in anonymously and, in the absence of -P, Kermit automatically
supplies a password of "user@host", where "user" is your local user
ID, and "host" is the hostname of the computer where Kermit is
running. If you do not include -p or -g, Kermit enters command mode so
you can type commands or execute them from a script.
If you include -p or -g, Kermit attempts to transfer the specified
files and then exits automatically at the end of the transfer unless
you also included -S (Stay). It uses the "brief" file transfer display
(one line per file) unless you include the -q option to suppress it.
When uploading files with -p, Kermit switches automatically between
text and binary mode for each file.
When downloading, you can either specify a particular mode (text or
binary) to be used for all the files, or you can let Kermit select the
type for each file automatically, based on its name (see [221]Sections
3.5 and [222]3.6 for greater detail). In UNIX be sure to quote any
wildcard characters to prevent the shell from expanding them, as shown
in the examples just below. Filename collisions are handled according
Kermit's FILE COLLISION setting (if specified in your Kermit
customization file; otherwise the default, which is BACKUP).
It should go without saying that the -P option should be used with
caution. In addition to the well-known risks of transmitting plaintext
passwords over the Internet, in this case the password also echos to
the screen if you type it, and can be seen in ps and w listings that
show the user's currently active command and command-line arguments.
Thus command-line FTP sessions are most appropriate for secure or
anonymous connections (those that do not require passwords).
Here's an example in which you download the latest C-Kermit "tarball"
from the Columbia University FTP archive:
ftp -A kermit.columbia.edu -bg kermit/archives/ckermit.tar.gz
This assumes that "ftp" is a symbolic link to C-Kermit. It logs you in
anonymously and gets the ckermit.tar.gz file in binary mode from the
kermit/archives directory.
Here's a slightly more ambitious example that illustrates CD'ing to
the desired server directory to get a group of files in text mode (in
this case the C-Kermit source files):
ftp -A kermit.columbia.edu -D kermit/f -ag "ck[cuw]*.[cwh]" makefile
In this case we CD to the kermit/f directory so we don't have to
include it in each file specification, and we quote the ck[cuw]*.[cwh]
specification so the shell doesn't expand it, since we have to pass it
as-is to the server. Note also that the quotes don't go around the
entire file list; only around each file specification that needs to be
quoted.
Here's one more example, that uploads a debug log file in binary mode
to the Kermit incoming directory (as we might ask you to do when
following up on a problem report):
ftp -A kermit.columbia.edu -D kermit/incoming -bp debug.log
In this case the -D option is required to tell the server where to put
the incoming file.
Unless the -Y option is included, your Kermit initialization file
(.mykermrc in UNIX, K95.INI in Windows) is executed before the command
line options, so you can set any FTP-related preferences there, as
described in the subsequent sections.
_________________________________________________________________
3.1.3. The FTP URL Interpreter
If Kermit is invoked with either its regular personality (as "kermit")
or its FTP personality (as "ftp"), you can also give a URL
(Universal Resource Locator) instead of a hostname and options,
with or without a username and password:
ftp ftp://user:password@host/path
ftp ftp://user@host/path
ftp ftp://@host/path (or ftp://:@host/path)
ftp ftp://host/path
kermit ftp://host/path
If the FTP personality is used, the service must be "ftp". In all
cases, a hostname or address must be included. If a user is included
but no password, you are prompted for the password. If a path
(filename) is included:
* If "@" is included without a user, Kermit prompts for the username
and password.
* If no user and no "@" are included, "anonymous" is used.
* GET is assumed.
If no path (and no action options) are included, an interactive FTP
session is started, as in this example:
ftp ftp://kermit.columbia.edu
If a path is included, but a username is not included, "anonymous" is
used and an appropriate user@host password is supplied automatically.
If authentication is successful, Kermit attempts to GET the file
indicated by the path or, if the path is the name of a directory, it
asks the server for a directory listing. In both cases, Kermit
disconnects from the server and exits after the operation is complete
(unless you have included the -S option on the command line).
Here's an example that gets a listing of the Kermit directory at the
Kermit ftp site:
ftp ftp://kermit.columbia.edu/kermit/
This example gets the top-level READ.ME file from the same directory:
ftp ftp://kermit.columbia.edu/kermit/READ.ME
Here's the same example, but requesting a text-mode transfer:
ftp -T ftp://kermit.columbia.edu/kermit/READ.ME
This illustrates that you can mix command-line options and URLs
if you desire.
Here's an example that logs in as a (fictitious) real user to get a
file:
ftp ftp://olga@ftp.xyzcorp.com/resume.txt
The password is not included, so Kermit prompts for it.
This scheme allows Kermit to be used as the FTP helper of other
applications, such as Web browsers, with all its advantages over other
FTP clients (especially the ones that are built in to most Web
browsers), e.g. that it can be given wildcards, and it can pick text
and binary mode automatically for each file.
HINT: suppose somebody sends you an FTP URL in email, or you see it in
some text. If your terminal screen supports copy/paste, copy the url,
and then at the shell prompt type "kermit", a space, and then paste
the URL, e.g.:
$ kermit ftp://alpha.greenie.net/pub/mgetty/source/1.1/mgetty1.1.27-O
"$ is the shell prompt; the part you type is underlined, the rest is
pasted in. Kermit does the rest.
_________________________________________________________________
3.1.4. Interactive FTP Session Establishment
As you read this and the following sections, bear in mind that any
command that can be given at the prompt can also be used in a script
program. Kermit's script programming language is the same as its
interactive command language. [223]CLICK HERE if you would like to
learn a bit more about script writing.
An FTP session is established with the FTP OPEN command:
FTP [ OPEN ] [ { /SSL, /TLS } ] hostname [ switches ] [ port ]
Opens an FTP connection to the given host on the given port
and, if FTP AUTOLOGIN is ON, also logs you in to the server,
prompting for username and password if necessary. If no port is
specified, the regular FTP protocol port (21) is used. The OPEN
keyword is optional (unless the hostname conflicts with one of
the FTP command keywords, which you can list by typing "ftp
?").
The hostname can be an IP host name, numeric IP address, or if you
have a network directory active (SET NETWORK DIRECTORY; see Chapter 6
of [224]Using C-Kermit), an entry name in the directory. In the latter
case, if the given hostname matches exactly one entry, the associated
name or address is used; if it matches more than one, Kermit cycles
through them until one is found that can be opened; if it matches
none, then the hostname is used as-is. If a directory is active but
you want to bypass directory lookup, include an "=" sign at the
beginning of the hostname, and/or use a numeric IP address.
When an FTP connection is opened, the default file-transfer mode is
set to binary if the client and server platforms are alike (e.g. both
of them are some kind of UNIX), and to text ("ascii") if they are not
alike. This has no particular effect for uploading since Kermit
automatically switches between text and binary mode for each file, but
might be important for downloading. The connection is also set to
Stream mode and File structure. Record- or page-oriented file
transfers are not supported by C-Kermit's FTP client.
The optional FTP OPEN switches are:
/ANONYMOUS
Logs you in anonymously, automatically supplying username
"anonymous" and user@host as the password, based on your local
user and host names.
/NOLOGIN
Overrides SET FTP AUTOLOGIN ON for this connection only.
/USER:name
Uses the given username to log you in, thus avoiding the Name:
prompt.
Overrides SET FTP AUTOLOGIN OFF for this connection only.
/PASSWORD:text
Uses the given text as your password, thus avoiding the
Password: prompt. This switch is not recommended for use in
script files, which would be a security risk.
/ACCOUNT:text
Uses the given text as your account (or secondary password,
depending on the requirements of the server; most servers do
not require or accept an account name). If an account is not
supplied, you are not prompted for one.
/PASSIVE
Opens the connection in passive mode. Passive mode is the
default in Kermit's FTP client, unlike in most others, since it
works better through firewalls. The /PASSIVE and /ACTIVE
switches apply only to the connection that is being opened, and
do not affect the global FTP PASSIVE-MODE setting.
/ACTIVE
Opens the connection in active mode. Use this switch if the
server does not support passive mode, or use the command SET
FTP PASSIVE-MODE OFF.
/NOINIT
Added in C-Kermit 8.0.201. Tells C-Kermit not to send REST,
STRU, FEAT, and MODE commands to the server when the connection
is opened, since these have been reported to cause confusion in
certain servers.
When a username or password is missing, a prompt is issued at the
controlling terminal and you must type the response; the response can
not be scripted. Use the switches to avoid prompts, or one of the
secure authentication methods described in the next section, or see
[225]SET FTP AUTOLOGIN and the [226]FTP USER and similar commands
described later in this section.
Examples:
ftp open kermit.columbia.edu /anonymous ; Open and log in anonymously
ftp kermit.columbia.edu /anonymous ; The OPEN keyword can be omitted
ftp xyzcorp.com ; Open and maybe prompt for username
ftp xyzcorp.com /user:olga ; Open and log in as olga
ftp testing.abccorp.com 449 ; Specify a special TCP port number
ftp testing.abccorp.com /user:olaf /password:secret 449
The FTP OPEN command succeeds if a connection was opened to the server
(even if the given username and password were not valid) and fails
otherwise (see [227]Section 3.8 for details).
When your FTP session is complete, you can terminate it as follows:
FTP BYE
Closes the FTP connection if one was open. The FTP prefix can
be omitted if no other connection is open at the same time (see
[228]Section 3.8 for details). If a connection log is active,
an FTP record is written to it. If Kermit was started with the
-9 command-line option or with its FTP command-line
personality, and the -S (Stay) option was not given, AND there
is no other active connection, the FTP BYE command also exits,
just as it does on a regular FTP client. Synonyms: FTP CLOSE,
FTP QUIT (but if the FTP prefix is omitted from QUIT, this
becomes the regular Kermit QUIT command, which is equivalent to
EXIT; i.e. it closes the connection and exits from Kermit).
The following commands can be used to achieve greater control over the
connection and login process:
SET FTP ANONYMOUS-PASSWORD text
Allows you to choose the password text to be sent automatically
by Kermit when you open an FTP connection with the /ANONYMOUS
switch.
SET FTP AUTOLOGIN { ON, OFF }
If you give this command prior to opening an FTP connection, it
controls whether Kermit tries to log you in automatically as
part of the connection process. Normally ON, which means the
username and password are sent automatically (and prompted for
if they are not yet known). When OFF, FTP OPEN connects to the
server without logging in. OFF is equivalent to the -n
command-line option when using Kermit's FTP command-line
personality.
FTP USER name [ password [ account ] ]
Used to log in to an FTP server to which a connection has been
made without autologin, or when autologin failed. If the
password is furnished on the command line, it is used;
otherwise you are prompted for a password. An account may also
be furnished if required by the server; it is not required by
Kermit and is not prompted for if omitted. Synonyms: USER, FTP
LOGIN.
FTP ACCOUNT text
Sends an account name to a server that supports accounts. If
the server does not support accounts, an error response occurs.
If the server does support accounts, the account is accepted if
it is valid and rejected if it is not. The account might be
used for charging purposes or it might be a secondary password,
or it might be used for any other purpose, such as an access
password for a particular disk. Servers that support accounts
might or might not allow or require the account to be sent
prior to login; usually it is sent after login, if at all.
Synonym: ACCOUNT.
Example:
set ftp autologin off ; One thing at a time please
ftp xyzcorp.com ; Try to make the connection
if fail exit 1 FTP connection failed ; Check that it was made
ftp user olga secret ; Now log in to the server
if fail exit 1 FTP login failed ; Check that it worked
ftp account 103896854 ; Login OK - send account
if fail echo WARNING - FTP ACCT failed ; Warn if problem
... ; (have session here)
bye ; Log out and disconnect
The following commands are used to control or get information about
the FTP connection. Any particular FTP server does not necessarily
support all of them.
FTP RESET
Terminates a user session but leaves the connection open,
allowing a new login via FTP USER.
FTP IDLE [ number ]
Most FTP servers automatically log you out and and disconnect
your session if there has been no activity for a certain amount
of time. Use this command to ask the server to set its idle
limit to the given number of seconds. Omit the number to ask
the server to inform you of its current idle limit.
FTP STATUS [ filename ]
Asks the FTP server to send information about the current
session. The result is a free-format report that might include
server identification, username and login time, FTP protocol
settings, and file-transfer statistics. If a filename is given,
the server is supposed to send detailed information about the
file.
FTP SYSTEM
Asks the FTP server to identify its operating system (Listed in
Internet Assigned Numbers, Operating System Names). Examples:
UNIX, VMS, VM/CMS, WINDOWS-NT. Unfortunately many variations
are allowed (e.g. LINUX-2.0, LINUX-2.2, FREEBSD, ULTRIX, etc,
instead of UNIX; WINDOWS-NT-3, WINDOWS-NT-3.5, WINDOWS-NT-3.51,
WINDOWS-NT-4, etc). The report might also include other
information like "Type L8", "Type I", or "Type A", indicating
the file-transfer mode.
FTP HELP [ keyword [ keyword [ ... ] ]
Asks the server to list the commands it supports. The response
is usually cryptic, listing FTP command mnemonics, not the
commands used by the client (since the server has no way of
knowing anything about the client's user interface). For
example, the PUT command is STOR in FTP protocol. If a keyword
is given, which should be an FTP protocol command,
slightly-more- detailed help is given about the corresponding
command (if the FTP server supports this feature). Examples:
"ftp help", "ftp help stor".
FTP SITE text
(Advanced) Sends an FTP SITE (site-specific) command. Usually
this means that the FTP server is asked to run an external
command with the given arguments. You might be able to find out
what SITE commands are available by sending "ftp help site" to
the server, but in general the availability of and response to
SITE commands is (not surprisingly) site specific.
FTP QUOTE text
(Advanced) Sends an FTP command in FTP protocol format. Use
this command to send commands to the server that the FTP client
might not know about.
SHOW FTP
Lists client (Kermit) FTP settings and information. Also SHOW
CONNECTION, SHOW COMMUNICATIONS.
HELP FTP [ keyword ]
Asks Kermit to list and describe its built-in FTP commands.
HELP SET FTP [ keyword ]
Asks Kermit to list and describe its built-in SET FTP commands.
[ [229]Top ] [ [230]FTP Top ] [ [231]C-Kermit Home ] [ [232]Kermit
Home ]
_________________________________________________________________
3.2. Making Secure FTP Connections
Also see: [233]Accessing IBM Information Exchange with Kermit.
In the previous section, you can see several examples of traditional
insecure authentication: username and password sent across the network
in clear text. Of course this is bad practice on at least two counts:
(1) storing passwords in files (such as script files) gives access to
the target systems to anybody who can obtain read access to your
scripts; and (2) sending this information over the network leaves it
open to interception by network sniffers or compromised hosts.
Because of the increasing need for security on the Internet, FTP
servers are beginning to appear that offer secure forms of
authentication, in which no information is sent over the network that
would allow anyone who intercepts it to usurp your identity and gain
your access rights.
Kermit provides an equivalent form of FTP security for each type of
IETF standard security implemented in Telnet. These include
GSSAPI-KERBEROS5, KERBEROS4, Secure Remote Password (SRP), and
Transport Layer Security (SSL and TLS). It does not presently include
SSL tunneling nor any form of SSH v1 or v2. When Kermit is built with
the necessary libraries, secure FTP connections are attempted by
default, in which all connections are authenticated and the command
and data channels are private.
The use of authentication and encryption for FTP connections can be
adjusted with the commands listed below, which are available only if
your version of Kermit was built with the corresponding security
options and libraries:
SET FTP AUTHTYPE { AUTOMATIC, GSSAPI-KRB5, KERBEROS4, SRP, SSL, TLS }
Specifies an ordered list of authentication methods to be
attempted when AUTOAUTHENTICATION is ON. The default list is:
GSSAPI-KRB5, SRP, KERBEROS_V4, TLS, SSL. If none of the
selected methods are supported by the server, an insecure login
is used as a fallback. Note, by the way, that SSL or TLS can be
used to secure an anonymous connection.
SET FTP AUTOAUTHENTICATION { ON, OFF }
Tells whether authentication should be negotiated by the FTP
OPEN command. Default is ON. Use SET FTP AUTOAUTHENTICATION OFF
to force a clear-text, unencrypted connection to FTP servers
(such as the one at the Kermit FTP site) that normally would
try to negotiate secure authentication and encryption.
SET FTP AUTOENCRYPTION { ON, OFF }
Tells whether encryption (privacy) should be negotiated by the
FTP OPEN command, which can happen only if secure
authentication is also negotiated. Default is ON.
SET FTP AUTOLOGIN { ON, OFF }
Tells Kermit whether to try logging in automatically when you
make an FTP connection, as opposed to letting you do it "by
hand" with the FTP USER command.
SET FTP COMMAND-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE
}
Determines the level of protection applied to the command
channel:
CLEAR Data is sent in plaintext and not protected against tampering.
CONFIDENTIAL Data is encrypted but not protected against tampering.
PRIVATE Data is encrypted and is protected against tampering.
SAFE Data is sent in plaintext but protected against tampering.
The default is PRIVATE.
SET FTP CREDENTIAL-FORWARDING { ON, OFF }
Tells whether end-user credentials are to be forwarded to the
server if supported by the authentication method (GSSAPI-KRB5
only). This is often required to allow access to distributed
file systems (e.g. AFS.)
SET FTP DATA-PROTECTION-LEVEL { CLEAR, CONFIDENTIAL, PRIVATE, SAFE }
Tells what level of protection is applied to subsequent data
channels. The meanings of the protection-level keywords are the
same as for SET FTP COMMAND-PROTECTION-LEVEL. The default is
PRIVATE.
SET FTP SRP CIPHER name
Specifies the cipher to be used for encryption when SRP
authentication is in use. The list of possible choices is
computed based on the capabilities of the local SRP library and
includes NONE plus zero or more of the following:
BLOWFISH_ECB CAST5_ECB DES_ECB DES3_ECB
BLOWFISH_CBC CAST5_CBC DES_CBC DES3_CBC
BLOWFISH_CFB64 CAST5_CFB64 DES_CFB64 DES3_CFB64
BLOWFISH_OFB64 CAST5_OFB64 DES_OFB64 DES3_OFB64
The default is DES3_ECB.
SET FTP SRP HASH name
Specifies the hash to be used for data protection when SRP
authentication is in use. The choices are MD5 and SHA. The
default is SHA.
Command-line options:
-k name
Specifies the realm to be used with Kerberos 4 authentication
(= SET AUTH K4 REALM name).
-f
Enables forwarding of Kerberos 5 credentials to the host when
using GSSAPI authentication (= SET AUTH K5 FORWARDABLE ON).
-x
Enables autoencryption (= SET FTP AUTOENCRYPTION ON).
-c cipher
Specifies the kind of cipher to be used for encryption with SRP
authentication. Equivalent to SET FTP SRP CIPHER, with the same
choices. If this option is not given, CAST5_CBC is used.
-H hash
Specifies the hash to be used for encryption with SRP
authentication. Equivalent to SET FTP SRP HASH, with the same
choices. If this option is not given, SHA is used.
-z debug
Turns on SSL/TLS debugging.
-z secure
Requires secure connection.
-z certsok
Says to accept all certificates without checking validity.
-z verify=n
Sets certificate verification mode to the given number, n:
0 = no verification
1 = verify certificate if presented
2 = require verification of certificate
-z cert=filename
Specifies a file containing a client certificate to be
presented to the FTP server.
-z key=filename
Specifies a file containing a private key matching the client
certificate.
-z !krb4
(nokrb4) Disables the use of Kerberos 4.
-z !gss
-z nogss
Disables the use of GSSAPI - Kerberos 5.
-z !srp
-z nosrp
Disables use of SRP.
-z !ssl
-z nossl
Disables the use of SSL.
-z !tls
-z notls
Disables the use of TLS.
Caution: If your FTP connection is secured via AUTH TLS, it is not
possible to interrupt a file transfer. This is a limitation of all
known FTP servers that support AUTH TLS.
Note that when using certain security methods, such as SSL or TLS, you
may be prompted to confirm or verify certain actions or conditions,
for example, whether to accept self-signed certificates. This can
interfere with unattended operation of scripts; see [234]Section 3.10.
[ [235]Top ] [ [236]FTP Top ] [ [237]C-Kermit Home ] [ [238]Kermit
Home ]
_________________________________________________________________
3.3. Setting FTP Preferences FTP preferences can be set globally and
persistently with the commands in the following sections; many of
these can also be overridden on a per-command basis with switches that
have the same name.
3.3.1. Logs, Messages, and Other Feedback
You can control the amount of feedback received from your FTP session
with the commands in this section. First, you can create a log of your
FTP transfers with the following commands:
SET TRANSACTION-LOG { VERBOSE, FTP, BRIEF }
Selects the log format. VERBOSE is the default, and is
described in [239]the manual. FTP chooses a WU-FTPD format, the
same as is used by the popular FTP server. BRIEF creates
per-file records in comma-separated-list format. For greater
detail, see [240]Section 4.17 of the [241]C-Kermit 7.0 Update
Notes.
LOG TRANSACTIONS filename
Records FTP (or Kermit, or any other protocol) uploads and
downloads in the given file using the format selected by the
most recent SET TRANSACTION-LOG command, if any, or else the
default format.
FTP screen messages and displays are controlled by the following
commands:
SET TRANSFER DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF }
FTP transfers use Kermit's normal file-transfer display styles.
Use this command to choose the desired format; the default on
most platforms is FULLSCREEN. The display is automatically
disabled if Kermit is running in the background or in batch.
BRIEF is always used for command-line initiated transfers
(unless suppressed by -q). While a file-transfer is in
progress, you can interrupt it in the normal Kermit way by
typing one of the following keys or key combinations:
X - Cancel current file but go on to the next one (if any).
Z - Cancel the entire transfer. Ctrl-L or Ctrl-W - Refresh
the file-transfer display (if any).
SET FTP DISPLAY { FULLSCREEN, CRT, SERIAL, BRIEF, NONE, OFF }
Like SET TRANSFER DISPLAY, but applies only to FTP connections,
and does not affect Kermit- or other protocol file transfers.
SET QUIET { ON, OFF }
This command applies to Kermit in general, not just FTP. OFF by
default; when ON, it surpresses most messages from most
commands as well as the file-transfer display.
SET FTP PROGRESS-MESSAGES { ON, OFF }
Tells whether Kermit should print locally-generated feedback
messages for each non-file-transfer command. ON by default.
SET FTP VERBOSE-MODE { ON, OFF }
Tells whether to display all responses from the FTP server. OFF
by default. This shows all responses to all commands, except
when the file-transfer display is active, and unless you have
SET QUIET ON. When OFF, responses are shown only for commands
such as FTP PWD whose purpose is to display a response.
SET FTP DEBUG { ON, OFF }
Tells whether local client debugging information should be
displayed. OFF by default. When ON, the commands that are sent
to the server are shown, as well as its responses (even if
VERBOSE-MODE is OFF), plus additional informational messages
are printed regarding the progress of secure operations. Also,
the temporary file created by the [242]MGET command is not
deleted so you can see what's in it.
Set all of these to OFF when silent running is desired.
3.3.2. Operational Preferences
FTP DISABLE new-protocol-feature-name
FTP ENABLE new-protocol-feature-name
Explained in [243]Section 3.11.
SET FTP AUTOLOGIN { ON, OFF }
If you give this command prior to opening an FTP connection, it
controls whether Kermit tries to log you in automatically as
part of the connection process. Normally ON, which means the
username and password are sent automatically (and prompted for
if they are not yet known). When OFF, FTP OPEN connects to the
server without logging in. OFF is equivalent to the -n
command-line option when using Kermit's FTP command-line
personality. See [244]Section 3.1.4 for usage.
SET FTP PASSIVE-MODE { ON, OFF }
ON by default, to avoid random TCP port assignment for data
connections, which can prevent FTP protocol from working
through firewalls and network address translators (for more on
these topics, see the [245]Kermit security reference. Set to
OFF in case the FTP server does not support passive mode, or in
case the client has problems with it (it has been observed, for
example, that when using passive mode, the SCO XENIX 2.3.4
TCP/IP stack hangs in the connect() call forever). Synonyms:
PASSIVE [ ON ], PASSIVE OFF, PASV [ ON ], PASV OFF.
SET FTP SEND-PORT-COMMANDS { ON, OFF }
This command determines whether the FTP client sends a new PORT
command to the server when accepting incoming data connections
(as when not using passive mode.) When PASSIVE-MODE is OFF and
SET SEND-PORT is OFF, the port that was originally specified is
reused. This is the default behavior for normal FTP clients but
it is not compatible with many firewalls.
SET FTP CHARACTER-SET-TRANSLATION { ON, OFF }
Whether to translate character sets when transferring files
with FTP (explained in [246]Section 3.7). OFF by default.
SET FTP SERVER-CHARACTER-SET name
Tells Kermit the character set used by the FTP server, UTF-8 by
default ([247]Section 3.7).
SET FTP SERVER-TIME-OFFSET delta-time
Tells Kermit to apply the given [248]delta time to file
timestamps provided by the server for its files; for use when
(for example) the server does not have its timezone set
correctly.
SET FTP ERROR-ACTION { PROCEED, QUIT }
When transferring a group of files with FTP, and an error
occurs with one of the files, Kermit normally goes on the next
file. Use SET FTP ERROR-ACTION to QUIT to make Kermit stop the
transfer immediately and fail if an error occurs with any
single file in the group. Example: you have given Kermit a list
of files to send, and one of the files can not be found, or
read permission is denied. Note that cancelling a file by
typing 'X' during transfer is not considered an error (if you
want to cancel the entire transfer, type 'Z' or Ctrl-C).
SET FTP PERMISSIONS { AUTO, ON, OFF }
When uploading files with PUT or MPUT, this tells whether
Kermit should send each file's permissions. The default is OFF,
which means not to send permissions, in which case the uploaded
file's permissions are set by the FTP server according to its
own criteria. ON means to send them, AUTO means to send them
only if the client (Kermit) and server are on like platforms
(e.g. both UNIX). This command has no effect when downloading,
since the FTP protocol does not include a way for the server to
inform the client of a file's permissions. Also see [249]FTP
PUT /PERMISSIONS. Note that setting permissions after uploading
is likely to work (correctly or at all) only when the client
and server platforms are alike (e.g. both of them are some form
of UNIX). Also note that Windows files don't have permissions.
Also see [250]FTP CHMOD.
SET FTP DATES { ON, OFF }
When downloading files with GET or MGET, this tells whether
Kermit should try to set the received file's date from the
server's date. FTP DATES is ON by default. Note, however, that
FTP protocol does not allow date preservation when uploading.
So at best, SET FTP DATES ON can work only when downloading,
and then only when the server agrees to furnish file dates.
SET FTP FILENAMES { AUTO, CONVERTED, LITERAL }
When uploading (sending) files, this tells whether to convert
outbound filenames to "common form". This means allowing only
one period in a name, uppercasing any lowercase letters,
replacing spaces by underscores, etc. AUTOMATIC is the default,
meaning LITERAL when client and server are the same type of
system (e.g. UNIX) and CONVERTED otherwise. Special case: if
the setting is AUTOMATIC and the client is not UNIX and the
server identifies itself as UNIX, Kermit uses a less-strict
form of conversion, in which lowercase letters are not
uppercased and the filename can contain any number of periods,
but spaces are still converted to underscore. When receiving,
conversion generally means to change all-uppercase names to
lowercase and spaces to underscore.
SET FTP UNIQUE-SERVER-NAMES { ON, OFF }
Applies only to uploads. Tells the server to create new, unique
names for incoming files that have the same names as existing
files. OFF by default, in which case the server overwrites
existing files with new files of the same name. When ON, the
server uses its own built-in method for creating new names for
incoming files; for example, appending a period (.) and a
number to the name. CAUTION: Use this option only if you do not
need to refer to the file after it is uploaded, since FTP
protocol provides no mechanism for the client to find out what
name was assigned by the server.
SET FTP COLLISION { ... }
When downloading, what to do if an incoming file has the same
name as an existing file. Options are the same as for SET FILE
COLLISION. If this command is not given, Kermit's regular FILE
COLLISION setting is used. If this command is given, it
overrides the FILE COLLISION setting for FTP transfers only.
See [251]Section 3.6.2 for details.
SET FTP TYPE { TEXT, BINARY, TENEX }
Changes the default transfer mode. When sending (uploading)
files, this command has no effect unless you disable automatic
text/binary mode switching ([252]Section 4) with SET FILE SCAN
OFF or SET TRANSFER MODE MANUAL. When receiving (downloading)
files, this command establishes the transfer mode to be used
when a filename does not match any of Kermit's text or binary
filename patterns, unless you use SET FTP
GET-FILETYPE-SWITCHING or SET TRANSFER MODE MANUAL to disable
automatic switching, in which case, this command establishes
the transfer mode for all downloaded files. In all cases,
however, the FTP TYPE can be overridden in any GET or PUT
command by including a /TEXT (/ASCII), /BINARY, or /TENEX
switch. The FTP TYPE is independent of the Kermit FILE TYPE
setting. TENEX is used for sending 8-bit binary files to 36-bit
platforms such as TOPS-10, TOPS-20, and TENEX, and getting them
back again. Synonym: ASCII = TEXT. Note: there is also an FTP
TYPE command, which does what SET FTP TYPE does but also sends
a TYPE command to the server immediately if the given type is
different from the current one.
If you want want specific FTP preference settings to be in effect for
all your Kermit FTP sessions, put the desired SET FTP commands in your
Kermit customization file (~/.mykermrc in UNIX, K95CUSTOM.INI in
Windows).
[ [253]Top ] [ [254]FTP Top ] [ [255]C-Kermit Home ] [ [256]Kermit
Home ]
_________________________________________________________________
3.4. Managing Directories and Files
In Kermit, commands for directory and file management can refer to:
* The local computer
* A remote computer when you have a connection to a Kermit server or
IKSD.
* A remote computer when you have a connection to an FTP server.
(There can also be an HTTP connection, but the commands in this
section don't apply to HTTP connections.)
Thus in general, each such command comes in three forms:
1. With no prefix in C-Kermit 8.0.200, it refers to the local
computer (CD, DIR, etc). In C-Kermit 8.0.201 and later, however,
the "locus" switches to automatically to the remote FTP server
when you make an FTP connection (see the SET LOCUS description
[257]Section 7); thus C-Kermit 8.0.201 acts almost exactly like a
regular FTP client when it has an FTP connection, yet still acts
like itself on other kinds of connections.
2. With the REMOTE prefix, it is for a Kermit server (REMOTE CD,
REMOTE DIR).
3. With the FTP prefix, it's for an FTP server (FTP CD, FTP DIR).
4. Also see [258]Section 3.8, which explains "R-commands" and
"L-commands".
Kermit's FTP file and directory management commands are as follows.
When an R-command is included in the Synonyms list, be sure to read
[259]Section 3.8 about rules for use of R-commands.
FTP CD [ directory ]
Tells the FTP server to change its default (working) directory
to the one given, which usually must be expressed in the syntax
of the server platform (UNIX, VMS, etc). If the directory is
not specified, the result depends on the FTP server -- it might
complain that the command is illegal, or it might change to
your original login directory. Synonyms: FTP CWD (Change
Wording Directory); RCD.
FTP CDUP
Tells the FTP server to change its default (working) directory
to the parent directory of its current one (equivalent to
"cd .." in UNIX, or "cd [-]" in VMS). Synonyms: RCDUP, FTP UP.
FTP PWD
Asks the FTP server to report ("print") its current working
directory. Synonym: RPWD.
FTP MKDIR directory
Asks the FTP server to create the directory whose name is
given. In general, the name must be in the syntax of the
server's file system, and it must be either absolute (a full
pathname) or relative to the server's current (working)
directory. This command fails if the directory can't be created
for any reason, including that it exists already. Synonym:
RMKDIR.
FTP RMDIR directory
Asks the FTP server to remove the directory whose name is
given. The rules are the same as for MKDIR, plus in most cases,
the server will not remove any directory unless it is empty.
Synonym: RRMDIR.
FTP DIRECTORY [ filespec ] [ redirectors ]
Tells the FTP server to send a directory listing of the
specified files. If no filespec is given, the server lists all
files in its current working directory. The results are in
whatever format the server chooses to send them. You can use
UNIX-like redirectors to send the listing to a file or a
pipeline, exactly as with the regular Kermit client/server
REMOTE DIRECTORY command ([260]Using C-Kermit, Chapter 11).
Synonym: RDIRECTORY. Examples:
ftp dir ; Show listing of all files on screen
ftp dir *.txt ; List *.txt files on screen
ftp dir *.txt > somefile ; Put listing in somefile
ftp dir *.txt >> somefile ; Append listing to somefile
ftp dir *.txt | sort > somefile ; Put sorted listing in somefile
ftp dir | more ; Runs list through "more"
ftp dir | sort | more ; Runs list through "sort" and "more"
FTP VDIRECTORY [ filespec ] [ redirectors ]
"Verbose" directory. This is an alternative FTP DIRECTORY
command primarily for use with DECSYSTEM-20 (TOPS-20) FTP
servers, which send only filenames when given a DIRECTORY
command; the VDIRECTORY command makes them also send file
sizes, dates, and attributes.
FTP CHECK filespec
Asks the FTP server whether the given file exists or, if the
filespec contains wildcards, if any files match, and this
command succeeds or fails accordingly.
FTP MODTIME filename
Asks the FTP server, via the not-yet-standard FTP MDTM command,
to send the modification date and time of the given file. The
response should be a numeric string in the format:
yyyymmddhhmmssxxxxx... where yyyy is the year, mm is the month,
dd is the day, hh is the hour (0-23), mm is the minute, ss is
the second, and xxx... is the optional fraction of the second
(0 or more digits). The date and time is expressed in UTC (GMT,
Zulu, Zero-Meridian). The result is available programmatically
in the [261]\v(ftp_message) variable, and is understandable by
Kermit's date-time switches and functions. For example, suppose
we want to upload all local files that are newer than a
particular file on the server:
C-Kermit> ftp modtime signpost
C-Kermit> echo \v(ftp_message)
20010807113542.014
C-Kermit> ftp mput /after:\v(ftp_message)GMT *
Note that we must append "GMT" to the date-time string to let
the /AFTER switch know the time is GMT rather than local.
FTP SIZE filename
Asks the FTP server to send the size (in bytes) of the given
file. The result might vary depending on whether the current
FTP TYPE is binary or text ("ascii"). For a reliable byte
count, do FTP TYPE BINARY first. The result is available
programmatically in the [262]\v(ftp_message) variable.
FTP CHMOD permissions filename
Tells the FTP server to set the permissions (protection) of the
given file to the ones given. The permissions and filename must
be given in whatever syntax is required by the server. Example
(for a UNIX-based FTP server):
ftp chmod 664 oofa.txt
Not all servers support this command. For non-UNIX-based
servers, you might need to use FTP QUOTE or FTP SITE and the
appropriate platform-specific FTP server command.
FTP UMASK [ number ]
This command is probably specific to UNIX-based servers; it
sets the UNIX "umask", which is the default permissions mask
for new (in this case, incoming) files. Crudely put, the UNIX
umask is an octal representation of a binary number in in which
a 1 bit stands for a permission bit that must be 0, and a 0 bit
stands for a permission bit that can be 0 or 1 depending on
other factors, such as the permissions of the parent directory.
Example: "umask 007" requires that new files are created
without read/write/execute world permission. If the number is
not specified, the server's current umask is reported.
FTP RENAME filename newname
Asks the FTP server to rename the file whose name is "filename"
to "newname". Works only for one file; can not be used with
wildcards. The server's interpretation of "newname" can vary
(in some cases it must be a filename, in others perhaps it can
also be a directory name, in which case if the filename denote
a regular file, the file might be moved to the given
directory). Some servers might allow files to be renamed
("moved") between physical disks or partitions, others might
not. Synonym: RRENAME.
FTP DELETE [ switches ] filespec [ filespec [ ... ] ]
Tells the FTP server to delete the file or files listed. Each
file specification may, but need not, contain wildcard
characters to match multiple files. File specifications and
wildcard syntax must be those of the server. Any file
specifications that contain spaces must be enclosed in braces
or doublequotes. FTP DELETE switches are:
/ERROR-ACTION: /FILENAMES: /NOBACKUPFILES /QUIET
/EXCEPT: /LARGER-THAN: /NODOTFILES /NOPAGE
/PAGE /RECURSIVE /SMALLER-THAN:
When used with FTP DELETE, the /RECURSIVE switch deletes files
but not directories, and furthermore depends on the server
providing recursive file lists, which is not the normal
behavior. For further details, see the decriptions of these
switches in [263]Section 3.6. Synonyms: FTP MDELETE (Kermit
makes no distinction between DELETE and MDELETE); RDELETE.
FTP TYPE { TEXT, BINARY, TENEX }
Tells the FTP server to change its file-transfer type to the
one given, immediately. See [264]SET FTP TYPE for details.
[ [265]Top ] [ [266]FTP Top ] [ [267]C-Kermit Home ] [ [268]Kermit
Home ]
_________________________________________________________________
3.5. Uploading Files With FTP
Uploading means sending files from the client (Kermit) to the FTP
server. The basic command for uploading files with FTP is PUT:
FTP PUT [ switches ] [ filespec [ as-name ] ]
Uploads (sends) the file or files that match the file
specification, which may include wildcards, to the server. If
no filespec is given, the names of files to send are taken from
the /LISTFILE: file, if any, otherwise from the SEND-LIST, if
any. Unless you go out of your way to prevent it, Kermit
determines the transfer mode (text or binary) for each file
automatically, and switches automatically on a per-file basis.
If an as-name is given, the file is sent under that name
instead of its own (if an as-name is given with a wildcard
filespec, the result is a bit more complicated, and is
explained later in this section).
Unlike normal FTP clients, Kermit does not prompt you by default (or
at all) for each file; it just sends them, just as it does with Kermit
protocol. The filespec can be a literal filename or a Kermit pattern,
described in:
[269]http://www.columbia.edu/kermit/ckermit70.html#x4.9
Kermit patterns are equivalent to C-Shell patterns and provide a fair
amount of flexibility in selecting which files to send, which is
augmented by the file-selection switches presented in [270]Section
3.5.1.
FTP MPUT [ switches ] filespec [ filespec [ ... ] ]
FTP MPUT is just like FTP PUT except it allows you to give more
than one file specification, and it does not allow an as-name
in the file list. However, as-names can be given to either PUT
or MPUT with the /AS-NAME: switch.
If a PUT or MPUT command results in one file being uploaded, it
succeeds if the file is uploaded completely and fails otherwise. If
more than one file is selected for upload, success or failure depends
on the [271]FTP ERROR-ACTION setting; if it is PROCEED (the default
setting), then the [M]PUT command succeeds if at least one of the
files was completely uploaded, and fails otherwise, If FTP
ERROR-ACTION is QUIT, the [M]PUT command succeeds if all selected
files were uploaded successfully, and fails if any file failed.
FTP uploads may be interrupted just like Kermit uploads. While the
transfer is in progress, type:
X to interrupt the current file and go on to the next file.
Z to cancel the current file and all remaining files.
^C (Control-C): Like Z, but might act more quickly.
MPUT may be used as in regular FTP clients, but it is not required to
send multiple files; in Kermit it is required only if you want to give
multiple file specifications. Examples:
ftp put oofa.txt ; Send a single file oofa.txt
ftp put oofa.txt budget.txt ; Send single file oofa.txt as budget.txt
ftp put *.txt ; Send all *.txt files
ftp mput *.txt ; Send all *.txt files (same as "put *.txt")
ftp mput *.txt foo.bar ; Send all *.txt files plus foo.bar
The distinction between PUT and MPUT is important only when more than
one filespec is given, just like the distinction between Kermit SEND
and MSEND:
ftp put oofa.txt budget.txt ; Send oofa.txt AS budget.txt
ftp mput oofa.txt budget.txt ; Send oofa.txt AND budget.txt
If the source file specification includes any path segments, for
example:
put /tmp/oofa.txt
put subdir/another/andanother/oofa.txt
the path portion is stripped from the filename that is sent to the
server. However, if an as-name contains a path, it is retained.
Examples:
ftp put /usr/doc/oofa.txt ; Send as "oofa.txt".
ftp put oofa.txt /tmp/oofa.txt ; Send as "/tmp/oofa.txt"
The latter example sends the file oofa.txt from your current local
directory to the server's /tmp directory. This works only if the
server uses the same directory notation that you used in the as-name
AND the given directory already exists on the server AND if you have
write access to it.
Use caution when uploading from a case-sensitive file system, such as
UNIX, to a file system that is not case sensitive, such as Windows or
VMS. If you have two files in UNIX, AA and aa and upload both of them,
the second one will overwrite the first. The only way around this
provided by FTP protocol is its "unique server names" feature (SET FTP
UNIQUE-SERVER-NAMES or the /UNIQUE switch described below).
_________________________________________________________________
3.5.1. FTP PUT Switches
FTP PUT and MPUT are similar in format and behavior to the regular
Kermit SEND and MSEND commands, and they allow most of the same
optional switches:
C-Kermit>ftp put ? Filename, or switch, one of the following:
/after: /larger-than: /rename-to:
/array: /listfile: /server-character-set:
/as-name: /local-character-set: /server-rename-to:
/before: /move-to: /simulate
/binary /nobackupfiles /smaller-than:
/command /nodotfiles /tenex
/delete /nofollowlinks /text
/dotfiles /not-after: /transparent
/error-action: /not-before: /type:
/except: /permissions: /update
/filenames: /quiet /unique-server-names
/filter: /recover
/followlinks /recursive
Since most of these switches are common to Kermit's SEND and MSEND
commands, they described only briefly here. For greater detail see:
[272]http://www.columbia.edu/kermit/ckermit70.html#x1.5 (explanation
of switches)
[273]http://www.columbia.edu/kermit/ckermit70.html#x4.7
(file-transfer switches)
First the file-selection switches:
/AFTER:date-time
/BEFORE:date-time
/NOT-AFTER:date-time
/NOT-BEFORE:date-time
Only send those files modified on or after or before the given
date and time. These switches can be combined to select files
modified between two date/times. Various date-time formats are
accepted; if the date-time contains spaces, it must be enclosed
in braces or doublequotes. See
[274]http://www.columbia.edu/kermit/ckermit70.html#x1.6 and
[275]Section 8.13 of this document for details about date-time
formats. Examples:
ftp put /after:{1 jan 2000 0:00:00} *
ftp put /after:-5days *
/LARGER-THAN:number
/SMALLER-THAN:number
Only send files larger (smaller) than the given number of bytes
(octets). These switches can be combined to select files in a
certain size range.
/TYPE:{TEXT,BINARY}
Only send files that are the given type, which is determined
for each file just before sending it by file scanning. BINARY
includes TENEX; if you have included a /TENEX switch, or
previously given a [SET] FTP TYPE TENEX command, binary files
are sent in TENEX, rather than BINARY mode.
/[NO]DOTFILES
[Don't] include files whose names begin with dot (.). By
default, such files are not included unless your filespec
explicitly mentions them.
/NOBACKUPFILES
Don't include files whose names end with .~nnn~, where nnn is a
number, e.g. oofa.txt.~27~. These are backup files created by
Kermit, EMACS, and other applications. By default, backup files
are included.
/NOFOLLOWLINKS
(UNIX only) Skip over symbolic links rather than following them
(default). This applies to wildcard and/or recursive [M]PUTs;
if a single filename is given, and it happens to be a symbolic
link, the file it points to is sent.
/FOLLOWLINKS
(UNIX only) Always follow (resolve) symbolic links, even in
wildcard or recursive [M]PUTs. Use with caution. Watch out for
circular links, endless loops, etc.
/EXCEPT:pattern
Exception list -- don't send files whose names match the given
pattern. See [276]Section 1.5.4 of the [277]C-Kermit 7.0 Update
Notes for details. If you want to exclude a directory from a
recursive [M]PUT, use /EXCEPT:{dirname/*}.
/RECURSIVE
Sends the desired files from the current (or given) directory,
plus all directories beneath it, including empty directories,
replicating the directory structure on the server. No special
capabilities are required in the server, but of course your
login ID on the server must have the appropriate access and
permission to create directories. Recursive PUTs work not only
between like platforms (e.g. UNIX to UNIX) but also between
unlike ones (e.g. UNIX to VMS or Windows), in which case
text-file format differences are handled by Kermit's automatic
text/binary mode switching ([278]Section 4) and character-set
translation ([279]Section 3.7). Synonym: /SUBDIRECTORIES.
/UPDATE
Send only files that have changed since last time ([280]Section
3.5.2).
/ARRAY:arrayname
The "file" to be sent is an array, or a segment of one, rather
than a real file. In this case the other selection switches
don't apply. The array contents are sent in text mode, and each
array element is treated as a line. Example:
ftp put /as-name:array.txt /array:&a
(or, to send a segment of the array, /array:&a[100:199]). If
you don't include an /AS-NAME, a name of "_array_x_" is used
(where x is the array letter). If you include this switch, most
other switches are meaningless and ignored.
/COMMAND
The "file" to be sent is the standard output of a command,
rather than a real file. It is sent in text or binary mode
according to the prevailing FTP TYPE, which can be overridden
with a /TEXT or /BINARY switch. Example: Example:
ftp put /command /as-name:{userlist} {finger | sort -r}
/LISTFILE:filename
Tells Kermit to obtain the list of files to be sent from the
file whose name is given. This file must contain one file
specification (which may be wild) per line. If the list
includes files from different directories, such as a recursive
listing of a directory tree, the paths are recreated on the
server (if possible) if you include the /RECURSIVE switch;
otherwise all the files are sent to the current directory on
the server.
Now the other switches:
/AS-NAME:text
If a single file is being sent, send it with the given text as
its name. If multiple files are being sent, the text must be a
template that includes variables such as \v(filename),
\v(filenumber), \v(ntime), to allow dynamic creation of each
name. The same applies to the as-name field of the FTP PUT
command. If this switch is not included (and an as-name is not
included as the second filename to PUT), each file is sent with
its own name.
/BINARY
/TEXT
/TENEX
Forces this upload to take place in the given mode, regardless
of the current FTP TYPE setting, and without automatic
text/binary switching. /ASCII is a synonym for /TEXT.
/FILTER:command
Specifies that the file(s) is/are to be passed through the
given command or pipeline on their way to the server. Example:
ftp put /binary /filter:{gzip -c \v(filename)} /as-name:\v(filename).gz *
/TRANSPARENT
/LOCAL-CHARACTER-SET:name
/SERVER-CHARACTER-SET:name
Character-set translation for text files, explained in
[281]Section 3.7.
/ERROR-ACTION:{PROCEED,QUIT}
Overrides the prevailing [282]FTP ERROR-ACTION for the duration
of this PUT or MPUT command only.
/RECOVER
Resume an interrupted transfer where from the point of
interruption (explained in [283]Section 3.5.2). Synonym:
/RESTART.
/DELETE
Tells Kermit to delete each source file immediately after, and
only if, it has been uploaded completely and successfully.
This, in effect, moves the file from the client to the server.
/MOVE-TO:directory
Tells Kermit to move each source file to the named local
directory after, and only if, it has been uploaded completely
and successfully.
/RENAME-TO:template
Tells Kermit to rename each (local) source file according to
the given template after, and only if, it has been uploaded
completely and successfully. The template works as in /AS-NAME.
/SERVER-RENAME-TO:template
Tells Kermit to ask the server to rename each file according to
the given template as soon as, and only if, it has been
received completely and successfully. The template works as in
/AS-NAME. Requires write and rename access on the server, so
doesn't usually work with (e.g.) anonymous uploads to public
incoming areas where the permissions don't allow renaming.
Examples:
ftp mput /server-rename:\v(filename).ok *
Appends ".ok" to each filename on the server when it's
finished uploading.
ftp mput /as-name:\v(filename).tmp /server-rename:\v(filename) *
This is the reverse of the previous example; it uses a
temporary name while uploading is in progress and reverts
the file to its real name when uploading is complete.
ftp mput /as-name:\v(filename)
/server-rename:../final/\v(filename) *
Moves the file from the working directory to a final
directory when the upload is complete, but in this case
you have to know the pathname syntax of the server. If
the rename fails, the [M]PUT command fails according to
the [284]FTP ERROR-ACTION selection.
/FILENAMES:{AUTOMATIC,CONVERTED,LITERAL}
Overrides the [285]FTP FILENAMES setting for this upload only.
/PERMISSIONS:{ON,OFF}
Overrides the [286]FTP PERMISSIONS setting for this upload
only.
/UNIQUE
Tells Kermit to tell the server to give [287]unique names to
incoming files that would otherwise overwrite existing files
that have the same name. This switch conflicts with /UPDATE,
/RECOVER, /PERMISSIONS, and /SERVER-RENAME since the client has
no way of knowing the name assigned by the server.
/QUIET
Don't display file-transfer progress or statistics.
/SIMULATE
Shows which files would be sent without actually sending them.
Useful (for example) with /UPDATE (next section). The results
are shown in the file-transfer display (if it is not disabled)
and in the transaction log (if one is active). Hint: use SET
TRANSFER DISPLAY BRIEF.
_________________________________________________________________
3.5.2. Update Mode
When you include the /UPDATE switch, this means to skip sending any
file that already exists on the server if the local file's
modification date/time is not later than that of the corresponding
file on the server. Here is a typical application for update mode:
Suppose that on Computer A, you maintain a large set of files (say, a
collection of Web pages and graphics images, or the source files for a
software application), and you need to keep a parallel copy on another
Computer, B. Of course you could upload the entire collection every
day:
cd source-directory
ftp computerb.xyzcorp.com
( authentication details... )
ftp cd target-directory
ftp put [ switches ] *
But if the total size is large or the network slow, this would be
unnecessarily time-consuming. Worse, if other users or sites had to
update whenever new files appeared in B's directory, this would cause
them unnecessary work. By including the /UPDATE switch:
ftp put /update [ other-switches ] *
only those files that changed since last time are uploaded. Here's how
it works. For each local file that is selected for uploading:
* The remote filename is determined in the normal way, according to
the [288]FTP FILENAMES setting, /FILENAMES switch, or the as-name,
if any.
* Kermit sends an MDTM (modification time) command for the
corresponding remote filename to the server.
* If the server does not understand the MDTM command, the file is
sent.
* If the server can't find a file with the given name, the file is
sent.
* If the local file's modification time is later than that of the
remote file, the file is sent.
* Otherwise -- the remote file exists but its modification time is
equal to or earlier than that of the local file -- the file is
skipped.
All time comparisons take place in Coordinated Universal Time
(UTC)([289]1), also known as GMT or Zulu time: Timezone 0; standard
time, without daylight savings.
WARNING: Some FTP servers, such as Novell NWFTPD.NLM, ignore or
misimplement the FTP specification and send local time rather than
UTC.
Update mode is useful only when always used in the same direction.
When you upload (PUT) a file with FTP, the destination file receives
the current timestamp on the server's computer, not the original
file's timestamp ([290]2). If you try to FTP PUT /UPDATE the same file
again, it will be skipped (as expected) since the remote copy is
newer. However, if you try to FTP GET /UPDATE the same file
([291]Section 3.6), it will be transferred for the same reason.
To check the availability of PUT /UPDATE on a particular connection,
issue an FTP MODTIME command for a file that is known to exist on the
server. If it succeeds, PUT /UPDATE should work and in that case, you
can run a procedure like the one above every day: the first time, it
sends all the files; after that, it sends only the ones that changed.
If a transaction log is active, a notation is included for any files
that are skipped.
Notes:
1. Why is Coordinated Universal Time abbreviated UTC? From the
[292]National Institute of Standards and Technology FAQ: "In 1970
the Coordinated Universal Time system was devised by an
international advisory group of technical experts within the
International Telecommunication Union (ITU). The ITU felt it was
best to designate a single abbreviation for use in all languages
in order to minimize confusion. Since unanimous agreement could
not be achieved on using either the English word order, CUT, or
the French word order, TUC, the acronym UTC was chosen as a
compromise."
2. The Kermit FTP client is unusual in that, when downloading only,
it can set the received file's date from the file's date on the
server, but this should not affect the update feature. When
uploading to an FTP server, however, there is no mechanism for the
client to set the date of the uploaded file on the server.
_________________________________________________________________
3.5.3 Recovery
Suppose that while you are uploading a large file over a slow
connection, the connection is lost before the entire file is
transferred. With most FTP clients, you would have to start over, thus
resending the portion of the file that was sent already, and that is
already on the server. But Kermit's /RECOVER switch (Synonym:
/RESTART) lets you continue an interrupted transfer from the point of
failure, thus transferring only the part that wasn't sent already. The
prerequisites for recovery are:
* The transfer must be in BINARY mode, or else the client and server
must reside on like systems (e.g. both on some form of UNIX).
* The FTP server must support the SIZE command.
Here's how it works. When you include the /RECOVER switch:
* Kermit checks for conflicting switches, such as /UPDATE and
/UNIQUE; if /RECOVER is given with these switches an error occurs.
If /RECOVER is given in other circumstances where it could serve
no useful purpose (e.g. with arrays, pipes, or filters), it is
ignored.
If the switch is accepted, then for each selected file:
* If it is not binary (determined by scanning) and the client and
server are not on like platforms, recovery is canceled (the entire
file is sent). Otherwise:
* A SIZE command is sent for the file (using its remote name). If
the reply indicates the file was not found, or the SIZE command
was not understood, or any other kind of error, recovery is
canceled. Otherwise:
* A MDTM (modification time) command is sent for the file. If a
valid reply is received, and the modification time of the local
file is later than that of the remote file, recovery is canceled.
Otherwise:
* If the sizes of the two files are identical, the file is not sent.
Otherwise:
* Kermit seeks to the recovery spot in the local file, tells the
server to APPEND the data which is about to arrive to the remote
file, and then sends the data starting at the recovery point.
To safeguard file integrity, recovery is not attempted unless all the
preconditions are met. For the widest possible usefulness, APPEND is
used rather than RESTART. For stream transfers (the only kind that
Kermit supports) the results are the same.
By design, the /RECOVER switch can be included with any FTP PUT or
MPUT command, even if it specifies a group of files. This allows you
to resume an interrupted batch transfer from where it left off. The
files that were already completely sent are skipped, the file that was
interrupted is recovered, and the remaining files are uploaded.
By the way, it doesn't matter how the original partial file was
uploaded -- FTP, Kermit, Zmodem, etc: as long as the preconditions are
met, it can be recovered with FTP PUT /RECOVER, or for that matter
also using Kermit protocol and SEND /RECOVER.
A word of caution, however, when the original upload was in text mode
with character-set translation ([293]Section 3.7):
* If the original upload involved a translation from one single-byte
character set to another (e.g. Code Page 850 to Latin-1), recovery
is safe if you specify the same translations for the recovery. If
you don't, the resulting file will contain a mixture of character
sets.
* If the original upload involved a translation that changed the
size of the file (e.g. from an alphabetic Code Page or Latin
Alphabet to Unicode, or vice versa), recovery is NOT safe, even if
you specify the same translations.
Kermit has no way of knowing anything about the previous upload. As a
safeguard, an error occurs if you include /RECOVER and also specify a
character-set of UCS2 or UTF8, since recovery can't possibly work in
that situation. Otherwise, it's up to you to avoid unsafe recovery
operations.
[ [294]Top ] [ [295]FTP Top ] [ [296]C-Kermit Home ] [ [297]Kermit
Home ]
_________________________________________________________________
3.6. Downloading Files With FTP
Although uploading files with Kermit's FTP client is just as easy and
flexible as sending files with Kermit protocol, the same is not always
true for downloading because FTP servers lack some of the capabilities
of a Kermit server:
* If you want to get more than one file, you have to use MGET, not
GET, since the underlying FTP protocol is different in the two
cases. Kermit can't "autodetect" which one you mean, as it can
with PUT and MPUT, since it can't be expected to know the wildcard
syntax of the remote platform and/or FTP server (the same is true
for all other FTP clients). To complicate matters, FTP protocol
now includes two underlying mechanisms (NLST and MLSD) for
accomplishing MGET operations and, as explained in [298]Section
3.11, the two behave differently.
* Automatic text-binary mode switching is not done by the server. It
can be done by the client (Kermit), but in this case it is not
based on a file scan (since there is no way for Kermit prescan a
server file), but rather on the filename, using C-Kermit 7.0
[299]filename patterns.
* Some options that are available with FTP PUT can not be used with
FTP [M]GET or don't work the same way:
/PERMISSIONS (FTP protocol has no mechanism for this).
/[NOT-]BEFORE, /[NOT-]AFTER (because of the timezone problem).
/RECOVER works only in binary mode. /RECURSIVE has limited
utility.
The commands for downloading are:
SET FILE DOWNLOAD-DIRECTORY [ directory ]
As with Kermit transfers, this command, if given, tells
C-Kermit where to store incoming files in the absence of a
specific as-name. If not given, incoming files are stored as
indicated by the as-name, if any, otherwise in the current
directory, just as with Kermit transfers. The more verbose
transfer display formats give the full pathname of each
received file, and, in case you have trouble finding a
downloaded file afterwards, its full path is also listed in the
transaction log (if you kept one), and you can also ask Kermit
where it went with the [300]WHERE command.
SET FTP GET-FILETYPE-SWITCHING { ON, OFF }
ON by default, causing Kermit to switch automatically into text
or binary mode for each file based on whether its name matches
a text pattern or binary pattern. Set this OFF, or use a /TEXT,
/BINARY, or /TENEX switch to defeat this feature. Use SHOW
PATTERNS to see the current pattern list.
[ FTP ] GET [ switches ] filename [ as-name ]
Asks the server to send the given file, and if it comes, stores
it locally under the given as-name, if any, otherwise under its
original name (modified according to the selected filename
conversion option), in your download directory, if you have
specified one, otherwise in the directory indicated in the
as-name, if any, otherwise in your current directory. If you
accidentally use a wildcard in the filename ("get *.txt") the
server will reply with a message like "File not found" (unless
there is a file whose name actually is "*.txt"). If FTP
GET-FILETYPE-SWITCHING is ON, and in the absence of any GET
switches to override it, the file is transferred in binary mode
if it matches any of Kermit's binary name patterns, and in text
mode if it matches any of Kermit's text name patterns, and in
the prevailing FTP TYPE if it matches none of these patterns.
[ FTP ] MGET [ switches ] filespec [ filespec [ filespec [ ... ] ] ]
Like GET, but for multiple files. One or more file
specifications can be given, and any or all (or none) of them
can contain wildcards or can be directory names. The file list
may not include an as-name, but you can still give one with the
/AS-NAME: switch.
In both the FTP GET and MGET commands, any filenames that contain
spaces must be enclosed in braces or doublequotes (see [301]Section 5
for details).
FTP downloads may be interrupted just like Kermit transfers. While the
transfer is in progress, type:
* X to interrupt the current file and go on to the next file.
* Z (or Control-C) to cancel the current file and all remaining
files.
Before proceeding, a brief word about temporary files. In FTP
protocol, the MGET command works by requesting a file list from the
server, and then (internally) issuing a GET command (FTP RETR protocol
directive) for each file. The file list returned by the server can be
any size at all, so in case it is huge, we don't store it in memory;
instead we put it in a temporary file. For troubleshooting purposes,
you should be aware of two points:
1. The location of the temporary file is chosen according the TMP or
TEMP environment variables. If neither of these variables is
defined, you might need to define it. In case there is not enough
space on the indicated disk or partition for the server's file
list, you might need to either clean up the temporary area, or
redefine the environment variable to indicate a different area
that has sufficient space.
2. If you want to look at the list yourself, use SET FTP DEBUG ON.
This tells Kermit to (a) give you the full pathname of the
temporary file at the end of each MGET command, and (b) not to
delete it, as it normally does.
_________________________________________________________________
3.6.1. FTP GET Switches
The following switches are available with FTP GET and MGET:
/TEXT
Specifies a text-mode transfer. Overrides the global FTP TYPE
setting and filename pattern-matching for the duration of the
current command only, All files are downloaded in text mode.
Synonym: /ASCII.
/BINARY
Specifies a binary-mode transfer. Overrides the global FTP TYPE
setting and filename pattern-matching for the duration of the
current command only. All files are downloaded in binary mode.
/TENEX
Like /BINARY but specifies a special binary transfer mode to be
used when getting 8-bit binary files from a 36-bit platform
such as TOPS-10, TOPS-20, or TENEX. All files are downloaded in
the special binary mode.
/RECOVER
This instructs Kermit to try to recover an incomplete download
from the point of failure. Works only in binary mode, and only
if the server supports the (not-yet-standard) FTP "REST"
directive. See [302]Section 3.6.3 for details. Synonym:
/RESTART.
/FILENAMES:{CONVERTED,LITERAL}
Overrides the [303]FTP FILENAMES (filename conversion) setting
for this download only, forcing incoming filenames to be either
converted or taken literally.
/AS-NAME:text
For GET, this is equivalent to giving an as-name after the
filename. For MGET, this is the only way to specify alternative
names for the incoming files. With MGET, the /AS-NAME text
should (must) contain a Kermit variable, usually \v(filename)
or \v(filenumber). Example:
mget /text /as-name:\v(filename).new *.c
This gets all ".c" files and stores them with "
.new" appended to their names. See the [304]C-Kermit 7.0 Update
Notes for details.
/COMMAND
This specifies that the incoming file is to be written to the
standard input of a command, rather than to a file. The command
name is the as-name from the GET command or the /AS-NAME
argument. If you need to refer to the incoming file's name in
the command, use \v(filename). See the description of the
regular Kermit [305]GET /COMMAND command for details and
examples.
/QUIET
Transfers the files quietly; don't put up a file-transfer
display.
/ERROR-ACTION:{QUIT,PROCEED}
This switch affects only MGET. If an error occurs with a
particular file, this tells whether to go on to the next file
(PROCEED) or to stop right away and fail (QUIT). The default is
PROCEED.
The file selection switches are:
/EXCEPT:{pattern} or /EXCEPT:{{pattern}{pattern}{...}}
Exception list for MGET; skip downloading any file whose name
matches any of the given patterns (when using the second
format, up to 64 patterns may be specified). [306]CLICK HERE
for syntax details.
/SMALLER-THAN:number
Download only files whose size is smaller than the given number
of bytes (octets). Requires that the FTP server support the
SIZE or MLSD directive.
/LARGER-THAN:number
Download only files whose size is greater than the given number
of bytes. Requires that the FTP server support the SIZE or MLSD
directive.
/NOBACKUPFILES
During MGET, don't download any files whose names end with
backup suffixes (.~n~ where n is a number).
/NODOTFILES
During MGET, don't download any files whose names begin with
period (.). Equivalent to /EXCEPT:{.*}.
/LISTFILE:local-filename
The given file contains a list of files to GET, one per line.
Filenames in the listfile can contain wildcard characters in
the syntax of the server. There is no limit on the number of
lines in the listfile.
/NAMELIST:local-filename
If this switch is given, then instead of actually retrieving
the selected files, the GET command retrieves a list of the
names of the files that would be retrieved, and places it in
the specifed file. The resulting file is an ordinary text file,
with one filename per line, suitable for reading by a person,
or processing by a computer program, including Kermit itself
(FOPEN / FREAD / FWRITE / FCLOSE), and as /FILELIST: file. If
the filename is omitted or given as "-" (dash, hyphen), the
list goes to the screen. NOTE: if you want a copy of the
complete list sent by the server, use SET FTP DEBUG ON, perform
an MGET, and the temporary file containing the list will be
kept rather than deleted (and Kermit tells you its name).
/UPDATE, /COLLISION:keyword
Explained in [307]Section 3.6.2.
/RECURSIVE
This means to try to download an entire directory tree, rather
than just files from a particular directory. In fact, FTP
protocol does not provide a method to request a recursive
download (unless the server supports MLSD; see [308]Section
3.11), so this works only if the FTP server does it anyway,
without being asked, as some do. In this case, Kermit detects
that names in the returned file list contain directory
separators, and therefore attempts to create the needed
directories as the files arrive. But this can work only if the
server is on the same kind of platform as the client, so the
pathname syntax can be recognized, and also because the server
does not switch between text and binary mode, which would be
vital for cross-platform transfers. Use with caution. Synonym:
/SUBDIRECTORIES.
Even when the server does not provide recursive file lists,
[M]GET /RECURSIVE forces Kermit to replicate any directory
structure implied or expressed by the server's file list. For
example:
get somepath/somefile
Gets the file named somefile from the server's somepath
directory and puts it Kermit's current (or download) directory,
whereas:
get /recursive somepath/somefile
creates the path locally and then puts the file in it.
Similarly for MGET:
mget */data/*
downloads all the files in all the data subdirectories of all
the subdirectories of the server's current directory and stores
them locally in Kermit's current (or download) directory,
whereas:
mget /recursive */data/*
re-creates the server's directory structure locally.
The FTP protocol does not include explicit mechanisms for recursion,
so Kermit builds upon what is available. Although an Internet draft
describes a mechanism ("MLSD") that would allow protocol-driven
recursion, similar to Kermit's File Attribute packets (circa 1984), it
has not yet attained RFC or standard status, and servers are not yet
widely available that offer this feature. In the meantime, the
effectiveness of MGET /RECURSIVE depends on the FTP server
implementation. If the server returns a recursive list in response to
the standard NLST command (whose behavior is ill-defined), Kermit's
FTP MGET /RECURSIVE command uses it to re-create the remote directory
tree locally. If the server supports MLSD, C-Kermit 8.0.206 and Kermit
95 2.1 and later are able to sense it automatically and use it, as
described below in [309]Section 3.11.
The /BEFORE:, /AFTER:, /NOT-BEFORE:, and /NOT-AFTER: switches are not
available for downloading because of the confusion with timezones.
Would the given times be in the local timezone, the server's timezone,
or GMT? The FTP server's directory listings show its own local times
but since we don't know what timezone the server is in, there's no way
to reconcile our local times with the server's. Similarly,
/PERMISSIONS can't be preserved in downloads because FTP protocol
provides no means of querying the server for a file's permission.
Source-file disposition switches:
/DELETE
Each file that is downloaded successfully is to be deleted from
the server. Requires the appropriate file access rights on the
server.
/SERVER-RENAME-TO:template
Asks the server to rename each (remote) source file immediately
after, and only if, it is sent correctly. See [310]PUT
/SERVER-RENAME-TO: for details.
Destination-file disposition switches:
/TO-SCREEN
Displays the incoming file on the screen rather than storing it
on disk. If this switch is given, the /RENAME-TO and /MOVE-TO
switches are ignored, the file-transfer display is suppressed,
and the given file(s) is/are shown on the screen. Can be used
with /FILTER, e.g.
get /text /to-screen /filter:more oofa.txt
In fact, you should always use /TO-SCREEN with /FILTER or
/COMMAND when the command would result in displaying the
incoming file on the screen; otherwise C-Kermit would have no
way of knowing to suppress its file transfer display (since it
can't be expected to know what the command or filter does).
/RENAME-TO:template
Each file that is downloaded is to be renamed as indicated if
and only if it was received completely and without error. The
template can be literal text or can contain variables that are
evaluated for each file. For MGET, the text must contain
variables; for GET it can be a literal string. The \v(filename)
variable contains the name of the current file, so:
ftp mget /rename-to:\v(filename).ok *
causes each file that is successfully downloaded to have ".ok"