A few months ago, I asked a friend to help me on a project to supply users with a public SSH “terminal” that would take the form of a wall mounted laptop with a light Linux install and a script to prompt users for SSH credentials. Well, fast forward a few months to when I discovered the magic of physical serial terminals, and the fact they can still be used with modern machines. I also had a Raspberry Pi lying around that was not being used, so I put two and two together and set off on constructing a public SSH terminal using the Pi.
My first challenge was trying to find a good terminal to go with. Most terminals, if not all, can use a standard DB9 serial connection, which can be boiled down to USB. I wrestled between two options, mainly an “all in one” more traditional option, or something more resembling a modern PC.
Which terminal should I purchase? Keep in mind the Fallout looking one is about $200 more than the other one. pic.twitter.com/y0FfivHgHt
— David Muckle (@dvdmuckle) September 15, 2016
In the end, I went for a VT420 as I like the amber monitor color, and I found instructions for hooking one up to a Pi. I also found I needed an adapter and a null modem cable in the DEC MMJ format. I picked up both from here. The null modem cable resembles a telephone cable, while the adapter is something you have to solder yourself. Because my soldering skills aren’t what they used to be, I ended up burning my thumb and giving up on soldering the adapter, instead ordering an OEM one from here. Note the null modem cable is still required to connect the adapter to the terminal. After getting these parts, I was able to hook up the terminal to a PC with a serial port.
NYAHA! IT’S ALIVE! pic.twitter.com/tFwjnB8NaD
— David Muckle (@dvdmuckle) October 1, 2016
Now, I had a choice. I could either use the GPIO pins on the Pi to get a serial port, or use a serial to USB adapter. I ordered both, to see if one would be better than the other. The end result was the USB adapter was much easier to configure, and more reliable, as many people chimed in on /r/retrobattlestations. I ordered a USB adapter with a PL2303 chip. Avoid the CH340/HL340 at all costs, it will lead to corrupted text on the terminal, and is widely regarded as “eBay trash.”
Here’s where things get… not as documented. Most documentation for getting a tty on a serial terminal use sysvinit, specifically the inittab file. Raspbian Jessie uses systemd, so it doesn’t have an inittab file. However, we can still get a serial terminal, if we make it a system service. Copy the skeleton file
/etc/systemd/system/, and rename it as you see fit. If you’re using a USB to serial adapter, rename it
serial-getty@ttyUSB0.service. It doesn’t really matter what it’s renamed to, but it helps for ease of use. Next, edit the
ExecStart= line in the skeleton file to work with your terminal. Mine looks like
ExecStart=-/sbin/agetty -a sshuser -p ttyUSB0 19200 vt420. You may need to put a -L in front of ttyUSB0. Note the baud rate is set to 19200. This has to be the same on your terminal side. I used the settings from here for configuring my VT420. Enable the systemd service with
sudo systemctl daemon-reload && sudo systemctl start serial-getty@ttyUSB0.service.
Last, I copied the SSH script onto my machine and configured everything properly. If you’d like to use the script, it as well as instructions for it can be found here.
So there you have it, a public SSH terminal. This will be sitting in the break room of the CS department on campus for the foreseeable future, or at least as long as I’m a student here at Clark University. Any questions can be directed towards either my Twitter or the comments below. Thanks again to ColtonDRG for help with the SSH script, without whom this project would probably have not happened.