Get the support materialCheck your mailbox for the link! View on YouTube
The getty
program (or actually agetty(8)
on Linux systems) is the traditional tool used to open a session on a Unix-like system from a text console. Historically, getty
was used to connect dumb serial terminals (teletype, or tty) to a mainframe system. Today it is still used to provide local login from the host text console. However, thanks to Unix uniform handling of devices, it can also be used to open remote sessions through a wide range of devices. This is commonly used in the embedded world to allow login through a TTL or RS232 serial port, but you can attach the getty
program to any communication device, as long as it presents a stream interface.
So, using the rfcomm(1)
tool provided as part of BlueZ, the official Bluetooth stack for Linux, we will emulate a serial port, both client-side and server-side. Then we will only have to attach the getty
program on that virtual serial port on one end of the link, and a terminal emulator of the other end, et voila: remote login through Bluetooth.
The video will also show you how you can create a systemd
service to automatically enable remote login over Bluetooth, something you may find useful on IoT devices or headless systems. And for better interoperability, I also show how to use sdptool(1)
to advertise your newly created Bluetooth end-point so you can use any standard Bluetooth serial console client to log into your Linux system. But if you plan to use such a solution in production, I need to warn you: some tools used here are deprecated in the latest releases of BlueZ. Unfortunately, as of today, there is no direct replacement. Also, watch the video up to the very very last image: there is a hint to remind you we are talking here about clear text communication over the air. But with a little bit of curiosity, you may find a solution to that latter issue.
Even if the solution described here can be used with most Linux systems, I am using a Raspberry Pi as my remote system in the video. Mostly because this is a low-cost and readily available single board computer ideal to experiment with. The board was installed as described in a previous video:
The only difference is I disabled SSH on the Raspberry Pi to make it clear we will log in to the board without ever using the IP network. And of course, since SSH was disabled, I had to plug a keyboard and monitor on the board to enter the first few commands.
If you don’t have the time to watch the video entirely, here are few links to jump directly to the section that interests you the most:
It’s a lot of work to maintain this channel, and the only thing I can take joy in from what I do is seeing more subscribers and the channel growing. That’s why I’m asking you to recommend and share the following links on your favorite social media and websites. Thanks!