SScHat - a Chat Application Build Using Native Linux Command-line Tools

A while back I read the following question on HN (Hacker News):

Ask HN: I have ssh, they have ssh, how can we chat?

I don’t want a dedicated client, I want to go back to the old ways of modem to modem over VT100 links and chatting that way. How can I ssh to another machine, or they to me, and we run a cli app that allows us to chat, something basic like wall I think would work, but I have never been able to get that to work.

I am on Mac OS X, and ideally I could do this without installing other software, using something built in.

Source: https://news.ycombinator.com/item?id=9716459

It’s a cool question, mostly because Unix has some great build-in tools that have proven themselves over the last few decades. So, is it possible to make a chat application with (native) Unix tools?

SScHat

SScHat – pronounced ‘shat’ (the ‘c’ is silent) – is nothing more than a few bash scripts that use the following Unix tools:

  1. ssh
  2. bash
  3. less
  4. touch
  5. cat
  6. screen*

* I’m aware that ‘screen’ is not native to all Unix distributions. Yet, it’s a very common tool and I’m quite confident most of you already have ‘screen’ installed. But if you are a stickler for the rules: you can run SScHat without ‘screen’. You’ll just have to open up two terminals, one running read.sh and the second one running chat.sh.

So how does it work?

The concept behind SScHat is probably one of the most basic designs for a chat applications you’ll every see. All it does is:

  1. It creates a text file on the server (if it doesn’t exist already).
  2. It runs a less +F over SSH on your conversation file creating your ‘read’ screen.
  3. And runs echo 'message' >> $CONVERSATION_FILE over SSH when sending a message.

To get started all you have to do is:

  1. Allow a (new) user – simply add their public key to ~/.ssh/authorized_keys – to SSH into the server where you want to store the conversation(s).
  2. Adjust the settings in config.sh.
  3. Run ./sshchat on the client.

Enjoy: https://github.com/rthijssen/sshchat

Final notes

As I said before, the main goal here was just to see if it was possible. But, anyone looking for a serious communication tools will (and should) immediately dismiss SScHat. Mostly because of it’s lack of features and missing ‘conversation integrity’. However no one can argue with me about the proven quality of the underlaying SSH library responsible for the end-to-end encryption ;)

Comments