Transfer your files with Kermit

Comment on Mastodon

Hi, it's been long time I wanted to write this article. The topic is Kermit,

which is a file transfer protocol from the 80's which solved problems of that

era (text files and binaries files, poor lines, high latency etc..).

There is a comm/kermit package on OpenBSD and I am going to show you how to use

it. The package is the program **ckermit** which is a client/server for kermit.

Kermit is a lot of things, there is a protocol, but it's also the

client/server, when you type **kermit**, it opens a kermit **shell**, where you

can type commands or write kermit scripts. This allows scripts to be done using

a kermit in the shebang.

I personally use kermit over ssh to retrieve files from my remote server, this

requires kermit on both machines. My script is the following:

#!/usr/local/bin/kermit +

set host /pty ssh -t -e none -l solene perso.pw kermit

remote cd /home/ftp/

cd /home/solene/Downloads/

reget /recursive /delete .

close

exit

This connects to the remote server and starts kermit. It changes the current

directory on the remote server into **/home/ftp** and locally it goes into

transfer if not finished (reget command), for every file finished, it's deleted

on the remote server. Once finished, it close the ssh connection and exits.

The transfer interfaces looks like this. It shows how you are connected, which

file is currently transferring, its size, the percent done (0% in the example),

time left, speed and some others information.

C-Kermit 9.0.302 OPEN SOURCE:, 20 Aug 2011, solene.perso.local [192.168.43.56]

Current Directory: /home/downloads/openbsd

Network Host: ssh -t -e none -l solene perso.pw kermit (UNIX)

Network Type: TCP/IP

Parity: none

RTT/Timeout: 01 / 03

RECEIVING: src.tar.gz => src.tar.gz => src.tar.gz

File Type: BINARY

File Size: 183640885

Percent Done:

...10...20...30...40...50...60...70...80...90..100

Estimated Time Left: 00:43:32

Transfer Rate, CPS: 70098

Window Slots: 1 of 30

Packet Type: D

Packet Count: 214

Packet Length: 3998

Error Count: 0

Last Error:

Last Message:

X to cancel file, Z to cancel group, <CR> to resend last packet,

E to send Error packet, ^C to quit immediately, ^L to refresh screen.

What's interesting is that you can skip a file by pressing "X", kermit will

stop the downloading (but keep the file for later resuming) and start

downloading the next file. It can be useful sometimes when you transfer a bunch

of files, and it's really big and you don't want it now and don't want to type

the command by hand, just "X" and it skips it. Z or E will exists the transfer

and close the connection.

Speed can be improved by adding the following lines before the reget command:

set reliable

set window 32

set receive packet-length 9024

This improves performance because nowadays our networks are mostly reliable and

fast. Kermit was designed at a time when serial line was used to transfer data.

It's also reported that Kermit is in use in the ISS (International Space

Station), I can't verify if it's still in use there.

I never had any issue while transferring, even by getting a file by resuming it

so many times or using a poor 4G hot-spot with 20s of latency.

I did some tests and I get same performances than rsync over the Internet, it's

a bit slower over Lan though.

I only described an use case. Scripts can be made, there are a lot of others

commands. You can type "help" in the kermit shell to get some hints for more

help, "?" will display the command list.

It can be used interactively, you can queue files by using "add" to create a

send-list, and then proceed to transfer the queue.

Another way to use it is to start the local kermit shell, then type "ssh

user@remote-server" which will ssh into a remote box. Then you can type

"kermit" and type kermit commands, this make a link between your local kermit

and the remote one. You can go back to the local kermit by typing "Ctrl+\",

and go back to the remote by entering the command "C".

This is a piece of software I found by lurking into the ports tree for

discovering new software and I felt in love with it. It's __really__ reliable.

It does a different job compared to rsync, I don't think it can preserve time,

permissions etc... but it can be scripted completely, using parameters, and

it's an awesome piece of software!

It should support HTTP, HTTPS and ftp transfers too, as a client, but I did not

get it work. On OpenBSD, the HTTPS support is disabled, it requires some work

to switch to libreSSL.

You can find information on the [official

website](http://www.kermitproject.org).