Remote access to Nitrogen8 boards with ShellHub

Published on June 30, 2021

Boundary Devices is excited to release this blog post in partnership with O.S.Systems to show how to remotely access your Nitrogen devices using ShellHub! This article will help those who want to start, create, or prototype an IoT or embedded project and reviews considerations like: security, agility, and remote access. We know sometimes people get lost facing all the different options the market offers, leaving behind features that could add real value to their products. Do you want to know how to get through all the options quickly & easily focusing on your goals? If so, please check the tips & suggestions we have prepared for you below.

Remote accessing a device

In this article, we’ll show you how to add a safe and agile remote access service for ShellHub to the Nitrogen8M Mini SBC. ShellHub is a recent tool released by O.S.Systems that provides remote connections through SSH in a friendly way. Besides making remote access easy, ShellHub offers various features that allow group users to access a set of devices using namespaces, manage firewall rules, record and playback sessions, use public keys to access devices, and much more. Note: we used a Nitrogen8M Mini here, but the instructions are compatible with any Boundary Devices platform.

1. First step: creating a Shellhub account

First of all, it’s necessary to create an account on the ShellHub server, also called by ShellHub Cloud. You’ll need an account to get the TENANT_ID used to identify the ShellHub agent and register it in ShellHub Cloud. The ShellHub agent is the application installed in devices responsible for connecting them to the ShellHub Cloud. There are three ways to install it. Here we’ll use the easiest one: using Docker. When you log in, a help screen will indicate the following steps to add devices, as shown in the image below: If you already use Docker, just skip the next section.

2. Installing Docker

To install and set up Docker, you can run the following steps in Ubuntu Focal or Debian Buster, and in both, the Shellhub will work correctly. Note: In case you are running the Debian Buster image, pay attention to the 2.1.1 section below First, check if the operating system is updated: $ sudo apt update To install Docker and curl command run this line: $ sudo apt install docker.io curl Initialize the Docker: $ sudo systemctl start docker Add the user permission for your user: $ sudo usermod -aG docker ${USER} $ su - ${USER}

2.1. Debian Buster specific: setting iptables as default firewall tool

An error may occur due to the incompatibility of Docker and Debian with network settings. Docker uses the iptables, and Debian Buster may use iptables and nftables, but the default is nftables. So, to fix it, run the commands below to change the setting: $ sudo update-alternatives --set iptables /usr/sbin/iptables-legacy $ sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy These commands change the subsystem type used. Then reboot the board.

3. Adding devices

With Docker installed, log on ShellHub and just copy the command line available in the help screen or access Add device button: You also may take the TENANT_ID in the top-right button on the Dashboard and type the command below: $ sudo curl -sSf "https://cloud.shellhub.io/install.sh?tenant_id=TENANT_ID" | sh

3.1 Accepting devices in the Cloud

After adding the ShellHub agent on board, the device will be available in the Devices section (see it below), and you’ll be able to accept or reject the device. All your allowed devices will be available in the Devices section to access them quickly whenever you need them. Easy, right?

4. Accessing devices

Many Linux users prefer using the Linux terminal to access remote machines and devices. ShellHub allows access to devices from both the ShellHub Cloud terminal and your local terminal. So you can choose the best option.

4.1. By Cloud terminal

To access your devices using the ShellHub Cloud terminal, just click on Devices in the sidebar, choose the device you want to access, and click on the terminal icon.

4.2. By local terminal

If you prefer to access your devices using your local terminal, open it up and run the SSH command with the ShellHub device identity, the TENANT_ID, running: $ ssh <device user name>@SSHID Take a look below: With a few steps, you have a great and innovative project ready to grow. With Shellhub installed and set up on Boundary Devices powerful boards, you’re ready to access and manage your devices from anywhere and create unique and modern products. We invite you to read about Boundary Devices portfolio of products and take a look at the Shellhub site to know more about the great things you can do. But if you’re interested in other ways to innovate using Boundary Devices and ShellHub, take a look at this article to learn how to set up the ShellHub agent support in a Yocto Project image. You're going to love it! If you have any issues, please email contato@ossystems.com.br!