Sending and Receiving Files with Kermit

From GlassTTY
Revision as of 08:43, 18 March 2019 by John (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Kermit is a computer file transfer/management protocol and a set of communications software tools. The tools need to be installed at each end of the link for the protocol to be used.

The article below describes the process for a very simple session to transfer files in either direction between two machines using either an SSH or serial connection and Kermit.

Kermit can be installed on Linux machines using the standard package repositories of the Linux distribution. Brew can be used to install Kermit on the Macintosh e.g.

   $ brew install c-kermit

Versions for Windows and most other platforms are available from http://www.kermitproject.org/current.html.

TCP Connection

On the local machine run Kermit, e.g.

   $ kermit

This will return the kermit prompt, e.g.

   C-Kermit 9.0.302 OPEN SOURCE:, 20 Aug 2011, for Mac OS X 10.14 (64-bit)
    Copyright (C) 1985, 2011,
     Trustees of Columbia University in the City of New York.
   Type ? or HELP for help.
   C-Kermit>

At this prompt, make the ssh connection as normal to the remote machine, e.g.

   C-Kermit> ssh 192.168.1.99

Once the remote connection has been made and the command line of the remote machine is made available, run kermit on this remote machine, e.g.

   $ ckermit

or

   $ kermit

This will show a similar response to when kermit was run on the local machine.

   C-Kermit 9.0.302 OPEN SOURCE:, 20 Aug 2011, for Linux (64-bit)
    Copyright (C) 1985, 2011,
     Trustees of Columbia University in the City of New York.
   Type ? or HELP for help.
   C-Kermit>

Serial Connection

To start a serial connection Kermit can be launched with a command similar to the one shown below. Alternatively launch kermit with no parameters and execute the SET commands explicitly. The parameter -8 refers to the communications setting 8 data bits, no parity and 1 stop bit.

   kermit -8 -C "SET LINE /dev/tty.Repleo-PL2303-00002014, SET CARRIER-WATCH OFF, SET SPEED 115200, SET FLOW XON/XOFF"

Once kermit is running locally execute the following command to connect to the remote system.

   CONNECT

Transferring Files

Manual Method

To download a file called foo.bar, the command SEND is issued at the remote kermit session e.g.

   SEND filename.com

It is then necessary to escape back to the local Kermit session, by pressing the key combination as described by the remote system when a connection is first made, typically Ctrl-/ C (Control + Forward Slash followed by C).

If there is a delay in switching back to the local session, the first Kermit packet may have already arrived and may appear appear as text on the screen, e.g.:

   9 S~/ @-#Y3~^>J)0___N"U1@G

As the Kermit protocol engine on the local session has not yet been started, the remote Kermit will timeout, and after a few seconds, retransmit this packet.

Having escaped back to the local session, all that is required is to type the command RECEIVE, the file is then transferred. Once complete the CONNECT command can be issued to reconnect to the remote session.

The procedure for uploading a file is the same, except that the SEND command is given at the local session and the RECEIVE command is given to the remote session.

Client Server Mode

If the remote Kermit session is set to server mode using the SET SERVER command, the protocol engine is started and all further instructions can be sent from the local session. In the client/server arrangement, everything is controlled by the client. In the example described here the client is assumed to be the local session, however, the roles can be reversed.

In addition to sending and receiving files, a Kermit server can also perform the same file management functions as an FTP server for example, directory listings, delete files, rename files, create directories, change directories etc.

When the server activity is complete the client/server session can be ended by issuing the command FINISH before re-connecting to the remote session using the command CONNECT. Alternatively the command BYE can be used to terminate the remote session and disconnect.

To receiver a file from the server, the following command is issued at the client.

   GET filename.ext

GET is used instead of RECEIVE. GET is active, it actively requests a file by name. RECEIVE is passive, it silently waits for an as-yet-unknown file to arrive from the remote Kermit, following a previously specified SEND command.


Auto-Download and Auto-Upload

In more recent Kermit versions, beginning about 1996 (the feature was first coded 11 September 1995), the manual switching between local and remote sessions is no longer necessary. In this case issuing the commands SEND or GET causes the Auto-Download and Auto-Upload feature to detect when a packet arrives. and to switch automatically to server mode long enough to handle the requested action.

Ending a Session

Once complete close the SSH connection and exit kermit, e.g.

   C-Kermit> close
   C-Kermit> exit